jeudi 19 octobre 2017

How to get ListView CheckBox column state

So i have ListView with CheckBox Column:

<GridViewColumn Header="Name">
    <GridViewColumn.CellTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
                <CheckBox Margin="0,0,0,0"/>
                <TextBlock x:Name="textBlock"
                       Text="{Binding Name}"
                       Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}}"
                       Style="{StaticResource TextBlockDefaultStyle}"
                       Margin="0,2,0,0"/>
            </StackPanel>
        </DataTemplate>
    </GridViewColumn.CellTemplate>
</GridViewColumn>

My model have several properties like Name, Description etc and my ListView contains also simple Checkbox.

My ListView populated with several objects and i want to achieve 2 things:

  1. In case i checks specific CheckBox i want all others CheckBox to become Uncheck (in case i have another CheckBox in Checked state)

  2. How to determine the specific checked object




Aucun commentaire:

Enregistrer un commentaire