I have the following XAML code:
<ListView x:Name="filterListView">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" IsChecked="{Binding SubIsSelected, Mode=TwoWay}" />
<TextBlock Grid.Column="1" Text="{Binding SubFilterName}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
This code allows me to select ListView
items like this:
What I want is for only the CheckBox
to be checkable, not the actual rows selectable, so it would look like this all the time no matter where I click:
I have tried adding the following changes but it just makes nothing selectable/clickable at all:
<ListView IsHitTestVisible="False" x:Name="filterListView" >
<CheckBox IsHitTestVisible="True" Grid.Column="0" IsChecked="{Binding SubIsSelected, Mode=TwoWay}" />
Anyone have an ideas on what I can do to make this work how I'd like? CheckBox
's checkable, everything else not selectable.
You can set the SelectionMode
to None
.