Yogesh Kumar

Yogesh Kumar

  • NA
  • 16
  • 2.8k

CheckBox Checked and Un-Checked Events in Data Grid Header

Nov 3 2015 5:47 AM
I have a grid in WPF, But i want that when we click on the header chekbox that all the checkbox in the action field must checked.  
 
 
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" Grid.RowSpan="2" Width="231" Height="130" HorizontalAlignment="Left" IsReadOnly="False" Margin="189,340,0,0" Name="dgstudent" TabIndex="7" VerticalAlignment="Top" Grid.Row="1" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Name" MinWidth="20" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Address}" Header="Name" MinWidth="20" IsReadOnly="True" />
<DataGridCheckBoxColumn Binding="{Binding IsSelected}">
<DataGridCheckBoxColumn.Header>
<CheckBox Name="chkSelectAll" Content="Actions" Checked="chkSelectAll_Checked" Unchecked="chkSelectAll_Unchecked"></CheckBox>
</DataGridCheckBoxColumn.Header>
</DataGridCheckBoxColumn>
</DataGrid.Columns>
</DataGrid>
 Note:- Don't give this link because its not working...
http://www.c-sharpcorner.com/UploadFile/0f100d/checkbox-checked-and-un-checked-events-in-data-grid-header/