I have implement datagrid as below and i have no idea how to with
checkbox named SelectGroupCheckBox check all checkbox in gruop.
- <DataGrid x:Name="PersonDataGrid"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Height="450" Width="902"
- CanUserAddRows="False"
- AutoGenerateColumns="False" >
- <DataGrid.GroupStyle>
- <GroupStyle>
- <GroupStyle.ContainerStyle>
- <Style TargetType="{x:Type GroupItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type GroupItem}">
- <Expander IsExpanded="False">
- <Expander.Header>
- <StackPanel Orientation="Horizontal">
- <CheckBox x:Name="SelectGroupCheckBox" >
-
- </CheckBox>
- <TextBlock Text="{Binding Name}"/>
- </StackPanel>
- </Expander.Header>
- <Expander.Content>
- <ItemsPresenter/>
- </Expander.Content>
- </Expander>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </GroupStyle.ContainerStyle>
- </GroupStyle>
- </DataGrid.GroupStyle>
- <DataGrid.Columns>
- <DataGridTemplateColumn>
- <DataGridTemplateColumn.Header>
- <CheckBox Content="Select All"
- Checked="CheckBox_Checked"
- Unchecked="CheckBox_Unchecked"/>
- </DataGridTemplateColumn.Header>
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <CheckBox IsChecked="{Binding IsSelected,
- Mode=TwoWay,
- UpdateSourceTrigger=PropertyChanged}"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTextColumn Binding="{Binding Person.Name}"
- Header="Name"
- Width="120"
- IsReadOnly="True"/>
- </DataGrid.Columns>
- </DataGrid>