使用DXGrid控件时,如何通过辅助复选框列实现多行选择?
作者:zhuhm 来源:本站原创 浏览:Loading...次 发布时间:2012-09-07 评论:0条
本示例只要展示了如何创建一个Boolean未绑定列,并使用它来选择/取消行。
VB.NET
<UserControl x:Class="DXGrid_MultiSelectColumn.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:DXGrid_MultiSelectColumn"> <StackPanel>
<Button Click="BtnInvert_Click">Invert selection</Button>
<Button Click="BtnGetSelected_Click">Get selection</Button>
<dxg:GridControl x:Name="grid" CustomUnboundColumnData="grid_CustomUnboundColumnData" Height="500">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id" />
<dxg:GridColumn FieldName="Number" />
<dxg:GridColumn FieldName="Selected" UnboundType="Boolean" AllowSorting="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:CheckEdit x:Name="PART_Editor" />
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" />
</dxg:GridControl.View>
</dxg:GridControl>
</StackPanel>
</UserControl>
<UserControl x:Class="DXGrid_MultiSelectColumn.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:DXGrid_MultiSelectColumn"> <StackPanel>
<Button Click="BtnInvert_Click">Invert selection</Button>
<Button Click="BtnGetSelected_Click">Get selection</Button>
<dxg:GridControl x:Name="grid" CustomUnboundColumnData="grid_CustomUnboundColumnData" Height="500">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id" />
<dxg:GridColumn FieldName="Number" />
<dxg:GridColumn FieldName="Selected" UnboundType="Boolean" AllowSorting="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:CheckEdit x:Name="PART_Editor" />
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" />
</dxg:GridControl.View>
</dxg:GridControl>
</StackPanel>
</UserControl>
C#
<UserControl x:Class="DXGrid_MultiSelectColumn.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:DXGrid_MultiSelectColumn"><StackPanel>
<Button Click="BtnInvert_Click">Invert selection</Button>
<Button Click="BtnGetSelected_Click">Get selection</Button>
<dxg:GridControl x:Name="grid" CustomUnboundColumnData="grid_CustomUnboundColumnData" Height="500">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id" />
<dxg:GridColumn FieldName="Number" />
<dxg:GridColumn FieldName="Selected" UnboundType="Boolean" AllowSorting="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:CheckEdit x:Name="PART_Editor"/>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" />
</dxg:GridControl.View>
</dxg:GridControl>
</StackPanel>
</UserControl>
<UserControl x:Class="DXGrid_MultiSelectColumn.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:DXGrid_MultiSelectColumn"><StackPanel>
<Button Click="BtnInvert_Click">Invert selection</Button>
<Button Click="BtnGetSelected_Click">Get selection</Button>
<dxg:GridControl x:Name="grid" CustomUnboundColumnData="grid_CustomUnboundColumnData" Height="500">
<dxg:GridControl.Columns>
<dxg:GridColumn FieldName="Id" />
<dxg:GridColumn FieldName="Number" />
<dxg:GridColumn FieldName="Selected" UnboundType="Boolean" AllowSorting="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<dxe:CheckEdit x:Name="PART_Editor"/>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" />
</dxg:GridControl.View>
</dxg:GridControl>
</StackPanel>
</UserControl>
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/DevExpress-Resources/Documentation-226.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/DevExpress-Resources/Documentation-226.html
关键字: DXGrid
评论列表
暂无评论
请谈谈你的看法 请使用IE或者Firefox浏览器,暂不支持Chrome!
慧都控件网为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
电话:400-700-1020
023-66090381
邮箱:sales@evget.com
相关资源
- ASP.NET MVC应用程序中使用XPO
- ASPxEditor套包问题
- ASPxGridView控件FAQ
- 中级信用环境中网站停止工作
- ASPxperience控件常见问题FAQ
- ASPxGridView主要特征以及方法
- ASP.NET MVC应用程序中初始化报表参数
- 添加ASPxNavBar控件到SharePoint 2010
- 如何在web程序的运行时状态下缩放报表?
- ASPxTreeList控件FAQ
- DevExpress使用心得
- ASPxGridView不支持编辑数据
- 如何序列化包含可序列化的DX控件的WPF窗体
- ASPxNavBar控件替换快速启动菜单
- ASPxPopupControl控件实现向下钻取报告
- 放大DXGrid单元格中的图像
- 如何修改DXGrid for WPF单元格的背景色?
- DXCharts创建二维面积图
- ASPxGridView处于客户端插入模式
- 设置ASPxGridView表头过滤器高度