获取CheckBox 。解决方法
获取CheckBox 。C# codesdk:DataGridTemplateColumn.HeaderStyleStyle TargetTypesdk:DataGridColumnH
获取CheckBox 。
C# code<sdk:DataGridTemplateColumn.HeaderStyle> <Style TargetType="sdk:DataGridColumnHeader"> <Setter Property="HorizontalContentAlignment" Value="Center"></Setter> <Setter Property="VerticalContentAlignment" Value="Center"></Setter> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal" Width="40" HorizontalAlignment="Center"> <TextBlock Text="全选"/> <CheckBox Name="chkAll" IsChecked="False" Checked="chkAll_Checked" Unchecked="chkAll_Unchecked"/> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style> </sdk:DataGridTemplateColumn.HeaderStyle>
后台代码获取 chkAll .
[解决办法]这是根据DataGrid查找某个特定子控件的问题,
可参照http://blog.csdn.net/fallincloud/article/details/6960255的查找子控件的方法。
[解决办法]Datagrid中Checkbox全选方法请参考:
http://www.silverlightchina.net/html/tips/2011/0921/10533.html
http://www.silverlightchina.net/html/tips/2011/0516/7674.html
http://www.silverlightchina.net/html/tips/2009/1118/241.html
遍历模板子控件方法,请参考:
http://www.silverlightchina.net/html/tips/2011/0917/10463.html
http://www.silverlightchina.net/html/tips/2011/0322/6272.html
http://www.silverlightchina.net/html/tips/2010/0627/1342.html