Praveen Gopal

Praveen Gopal

  • NA
  • 90
  • 9.4k

Select all using Checkbox in datagrid header?

Nov 16 2016 11:13 AM
i have datagrid...i display all the values using binding....
Eg: 
<DataGridTextColumn IsReadOnly="True" Binding="{myUserControls:CultureAwareBinding Path=ConcentrationWithSignalConsideration}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="Concentr Signal Factor" Width="50" TextWrapping="Wrap"/>
</DataTemplate>
</DataGridTextColumn>
 
In that grid i have checkbox column...  
 
<DataGridTemplateColumn Width="50" x:Name="statusTest">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding selectall}"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="TestCheckBox" Margin="14,0,0,0" IsThreeState="True"
IsChecked="{Binding Path = SelectedItem,
Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
 
If i check the check box in datagrid header it need update all the check boxes in that column...
 
The behaviour is shown in picture

Answers (2)