Devexpress silverlight网格标题复选框列

时间:2014-01-02 09:30:35

标签: asp.net silverlight grid devexpress

是否可以使用客户端事件或服务器端事件,根据网格标题check box列选择或取消选择silverlight devexpress gridcheckbox复选框。

示例代码:

        <dxg:GridControl.View>
            <dxg:TableView NavigationStyle="Cell" VerticalContentAlignment="Top"   AllowColumnFiltering="True" AllowFilterEditor="True" ShowTotalSummary="True" Foreground="Black" ShowGroupPanel="False" AllowEditing="False" >
            </dxg:TableView>
        </dxg:GridControl.View>
        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="EID" Fixed="Left" Width="70"  VerticalAlignment="Top" AllowFocus="False" FilterPopupMode="CheckedList"></dxg:GridColumn>
            <dxg:GridColumn FieldName="EN" Header="Name" Width="180" AutoFilterCondition="Contains" Fixed="Left" VerticalAlignment="Top" AllowFocus="False" FilterPopupMode="CheckedList" />
            <dxg:GridColumn FieldName="DOJ" Header="Date Of Joining" Width="110" AllowFocus="False" FilterPopupMode="CheckedList" />
            <dxg:GridColumn FieldName="CEX" Width="170" Visible="True" AutoFilterCondition="Like" AllowFocus="False" FilterPopupMode="CheckedList" />
    <dxg:GridColumn FieldName="CheckBoxColumn" Width="170" Visible="True" AutoFilterCondition="Like" AllowFocus="False" FilterPopupMode="CheckedList" />
    </dxg:GridControl.Columns>
        <dxg:GridControl.GroupSummary>
            <dxg:GridSummaryItem SummaryType="Count" />
        </dxg:GridControl.GroupSummary>
        <dxg:GridControl.TotalSummary>
            <dxg:GridSummaryItem FieldName="EID" ShowInColumn="EN" SummaryType="Count"/>
        </dxg:GridControl.TotalSummary>
    </dxg:GridControl>

1 个答案:

答案 0 :(得分:0)

您必须修改单元格模板才能达到您想要的效果。 它将是这样的:

        <dxg:GridColumn VisibleIndex="38" Header="h1" FieldName="h1" Name="h1">
            <dxg:GridColumn.CellTemplate>
                <DataTemplate>
                    <dxe:CheckEdit IsChecked="True"  HorizontalAlignment="Center">
                    </dxe:CheckEdit>
                </DataTemplate>
            </dxg:GridColumn.CellTemplate>
        </dxg:GridColumn>

创建新模板后,您可以访问您的列并加载其内容以修改其中的元素:

var checkBox = MyGrid.Columns["h1"].CellTemplate.LoadContent() as DevExpress.Xpf.Editors.CheckEdit

然后

checkBox.IsChecked = true

希望它有所帮助!