I have a WPF datagrid with datagrid check box column as first column and the header of the checkbox column is also a check box..

I am using the follwoing code to achieve this..

<TK:DataGridCheckBoxColumn Width="30" Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type TK:DataGridRow}}}">
                                            <Style TargetType="{x:Type TKPrimitives:DataGridColumnHeader}">
                                                <Setter Property="Background" Value="{StaticResource HeaderBackgroundBrush}"/>
                                                <Setter Property="BorderBrush" Value="{StaticResource HeaderBorderBrush}" />
                                                <Setter Property="BorderThickness" Value="0,1,0,1" />
                                                <Setter Property="Height" Value="20" />
                                                <Setter Property="FontSize" Value="11" />
                                                <Setter Property="FontFamily" Value="Verdana" />
                                                <Setter Property="Template">
                                                        <ControlTemplate TargetType="{x:Type TKPrimitives:DataGridColumnHeader}">
                                                                <TK:DataGridHeaderBorder x:Name="headerBorder" 
                                                                                    Background="{TemplateBinding Background}"
							                                                        BorderBrush="{TemplateBinding BorderBrush}"
							                                                        BorderThickness="{TemplateBinding BorderThickness}">
                                                                    <Border BorderBrush="{StaticResource HeaderInnerBorderBrush}" 
                                                                        <CheckBox x:Name="HeaderCheckBox" HorizontalAlignment="Center"  Content="{Binding}"  Click="HeaderCheckBox_Click"/>

But my question is by using this code i have got the select all succesfully..but by selecting one check box in the list another check box is deselecting (With out holding Cntrl key)..But by using Cntrl key i am able to select multiple items in the list..

But I need code for only by clicking on check box with out using Cntrl key user can select the mutiple items in the datagrid..

Can any one help me..

Thanks in advance for help..


Sravanthi Ch

This article has been dead for over six months. Start a new discussion instead.