1

I Have some objects (Programatically added) all of them are childs of a Grid stored into ScrollViewer

<UserControl x:Class="MyNS.Recursos.Controles.Controls.Esquemas.SchemaContainerControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:MyNS.Recursos.Controles.Controls.Esquemas"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800"
             x:Name="ThisSchemaContainerControl">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding ElementName=ThisSchemaContainerControl,Path=SchemaToShow.Titulo}" Style="{DynamicResource BlockHeaderWarning}"/>
            <ScrollViewer Grid.Row="1">
                <Grid x:Name="SchemaMainGrid">

                </Grid>
            </ScrollViewer>
        </Grid>
    </Grid>
</UserControl>

I have this custom control

<local:SchemaControlBase x:Class="MyNS.Recursos.Controles.Controls.Esquemas.SchemaCie10"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:MyNS.Recursos.Controles.Controls.Esquemas"
             xmlns:ctr="clr-namespace:ParadigmaN.Recursos.Controles.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800"
             x:Name="ThisSchemaCie10">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding ElementName=ThisSchemaCie10,Path=Title,FallbackValue=Item-Title}" Style="{DynamicResource SchemaItemTitleStyle}"/>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="10*"/>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ctr:Search 
                SearchParms="{Binding ElementName=ThisSchemaCie10,Path=BusqCie10}" 
                SelectedItem="{Binding ElementName=ThisSchemaCie10,Path=Cie10,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"/>
            <ComboBox 
                ItemsSource="{Binding ElementName=ThisSchemaCie10,Path=TiposDiagnostico}"
                DisplayMemberPath="Descripcion"
                SelectedItem="{Binding ElementName=ThisSchemaCie10,Path=TipoDiagnosticoSeeleccionado,UpdateSourceTrigger=PropertyChanged}"
                Grid.Column="1"/>
            <Button
                Margin="7,0,7,0"
                Command="{Binding ElementName=ThisSchemaCie10,Path=AddCommand}"
                Style="{DynamicResource InLineAddButton}"
                Grid.Column="2"/>
        </Grid>
        <ListView
            Grid.Row="2"
            ItemsSource="{Binding ElementName=ThisSchemaCie10,Path=Diagnosticos}"
            HorizontalContentAlignment="Stretch"
            SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="10*"/>
                            <ColumnDefinition Width="2.5*"/>
                        </Grid.ColumnDefinitions>
                        <Button
                            Margin="5,0,10,0"
                            Style="{DynamicResource InLineDeleteButton}"
                            Command="{Binding ElementName=ThisSchemaCie10,Path=DeleteCommand}"
                            CommandParameter="{Binding }"/>
                        <TextBlock Text="{Binding CodigoCie10}" Grid.Column="1"/>
                        <TextBlock Text="{Binding Descripcion}" Grid.Column="2"/>
                        <TextBlock Text="{Binding DescripcionTipo}" Grid.Column="3"/>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</local:SchemaControlBase>

It draw a list view. But when I do scroll with mouse over the items list scroll stops working.

What I'm doing wrong ?

Why it doesn't take the scroll event like other elements (TextBox,TextBlock,CheckBox etc)?

Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101

0 Answers0