mardi 23 août 2016

Selecting a partially displayed WPF checkbox

so I am having a design problem and I know there has to be a way to make it work. I tried the solutions here: Annoying auto scroll of partially displayed items in WPF ListView But they didnt work for some reason. I have a list of items from a wpf listbox. like this:

Listbox picture

when I try to select the checkbox in line 5, the window centers on it but does not check it.

here is the xaml for the listbox:

   <ListBox Margin="4 8 " Grid.Row="1"  ItemsSource="{Binding Path=CheckoutVM,Mode=TwoWay,IsAsync=True}" 
              SelectedItem="{Binding Path=SelectedPermit}"  Grid.Column="0" BorderThickness="0" 
              KeyboardNavigation.TabNavigation="Continue"  Name="RequestCheckoutV" >

and here is the style:

   <ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
                        <Setter Property="Background" Value="Transparent" />
                        <Setter Property="Control.HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="Control.VerticalContentAlignment" Value="Top"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}"  >
                                    <ContentPresenter />
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>

What can I do to make this select the checkbox instead of just centering it? Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire