首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

获取控件值解决思路

2012-12-30 
获取控件值本帖最后由 kingdom_0 于 2012-08-28 14:05:54 编辑sdk:DataGridTemplateColumn Header全选

获取控件值
本帖最后由 kingdom_0 于 2012-08-28 14:05:54 编辑

  <sdk:DataGridTemplateColumn Header="全选"  CanUserResize="False" Width="44">
                            <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" HorizontalAlignment="Center">
                                                    <TextBlock Text="" Width="12"/>
                                                    <CheckBox Name="chkAll" Checked="chkAll_Checked" Unchecked="chkAll_Unchecked"  />
                                                </StackPanel>
                                            </DataTemplate>
                                        </Setter.Value>


                                    </Setter>
                                </Style>
                            </sdk:DataGridTemplateColumn.HeaderStyle>
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                                        <CheckBox HorizontalAlignment="Center" Name="CheckBoxOSId" Tag="{Binding}"></CheckBox>
                                    </StackPanel>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>   


代码如上,DataGrid中的HeaderStyle样式中有一个Checkbox同时页面上有一个删除按钮,点击删除按钮,根据全选CheckBox 是否选中实现批量删除
如何获取  Name="chkAll" 的 CheckBox 的值?最好有满足需求的代码供参考,谢谢
[解决办法]
明白啦

热点排行