Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Add check box for check/uncheck all to the header

$
0
0

HI ,

IM using the following code for for check box,
I need that the first column header will be also check box which is responsible
on check or uncheck all ,how can I do that?

<DataGrid RowHeaderWidth="0" ItemsSource="{Binding Items}" AutoGenerateColumns="False" CanUserAddRows="False"><!--<DataGrid.Resources><SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue" /></DataGrid.Resources>--><DataGrid.Columns><DataGridTemplateColumn Header="1" Width="*"><DataGridTemplateColumn.CellTemplate><DataTemplate><CheckBox IsChecked="{Binding Column1, UpdateSourceTrigger=PropertyChanged}"/></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn><DataGridTextColumn Binding="{Binding Column2}" Header="2" Width="*" /><DataGridTextColumn Binding="{Binding Column3}" Header="3" Width="*" /><DataGridTextColumn Binding="{Binding Column4}" Header="4" Width="*" /><DataGridTextColumn Binding="{Binding Column5}" Header="5" Width="*" /></DataGrid.Columns><DataGrid.ItemContainerStyle><Style TargetType="DataGridRow"><Style.Triggers><DataTrigger Binding="{Binding Column1}" Value="True"><Setter Property="Background" Value="Transparent"/></DataTrigger></Style.Triggers></Style></DataGrid.ItemContainerStyle> </DataGrid>



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>