DataGrid单列排序和多列排序的写法?

shadow_2006 2010-10-19 04:36:52
如题,单列一般是升序或者降序,多列是根据两列的综合条件来排序。求大神指教...
...全文
84 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
starheart 2010-10-20
  • 打赏
  • 举报
回复
System.Windows.Data.PagedCollectionView pgv为DataGrid的数据源,则
pgv.SortDescriptions.Clear();
pgv.SortDescriptions.Add(new System.ComponentModel.SortDescription(sortFieldName1, System.ComponentModel.ListSortDirection.Ascending));
pgv.SortDescriptions.Add(new System.ComponentModel.SortDescription(sortFieldName2, System.ComponentModel.ListSortDirection.Descending));
Sunpire 2010-10-19
  • 打赏
  • 举报
回复
数据源使用 PagedCollectionView ,它对 IEnumerable source 数据源对行了封装,
提供了

SortDescriptions 以指定排序
GroupDescriptions 以指定分组
badi888 2010-10-19
  • 打赏
  • 举报
回复
.OrderBy().ThenBy()
shadow_2006 2010-10-19
  • 打赏
  • 举报
回复
是silverlight里的datagrid

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧