ListView with CheckBox
Posted: 27 Feb 2019, 15:38
Hi,
Anyone having a way to retrieve the listview raw at the moment you check a checkbox ?
When you check the CheckBox, the listview row is not selected (I tried all SelectionModes) so no way to get the SelectedItem or SelectedIndex.
I'm running out of ideas... :p
I have the following XAML code:
Anyone having a way to retrieve the listview raw at the moment you check a checkbox ?
When you check the CheckBox, the listview row is not selected (I tried all SelectionModes) so no way to get the SelectedItem or SelectedIndex.
I'm running out of ideas... :p
I have the following XAML code:
Code: Select all
<ListView x:Name="itListViewFiles" SelectionMode="Single">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Visibility" Value="Hidden"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Header="">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox Margin="0" VerticalAlignment="Center" IsChecked="{Binding IsChecked}" Checked="OnCheck"></CheckBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{StaticResource locRevitFileName}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0" Text="{Binding Text}"></TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>