在DataGrid中对数据进行分组 [英] Grouping data in a DataGrid
问题描述
我无法在DataGrid中对数据进行分组。经过一些研究,我了解到运行时的最后一分钟更改删除了GroupDescription和SortDescription属性;至少在XAML中。听起来它仍然可以通过代码隐藏起来。在我的项目中,我有
references 到System.Windows.Data和SystemComponentModel.DataAnotations。我无法添加对System.ComponentModel的引用,因为它不在列表中。在我的代码隐藏页面上,我有一个'using System.ComponentModel;'语句。当我尝试创建一个PagedCollectionView时,例如:
PagedCollectionView taskListView = new PagedCollectionView(taskList);
taskListView.GroupDescriptions.Add( new PropertyGroupDescription( " State" ));
我收到以下错误:
找不到类型或命名空间名称'PagedCollectionView'(您是否缺少using指令或程序集引用?)
如何做我参考这些我可以在DataGrid中对数据进行分组吗?另外,有没有人知道从XAML中删除这些内容的理由是什么。
问候士Patrick
I am having trouble grouping data in a DataGrid. After some research, I understand that there was a last minute change to the runtime that removed GroupDescription, and SortDescription properties; at least in XAML. It sounds like it is still possible via code behind. In my project, I have
references to Both System.Windows.Data, and SystemComponentModel.DataAnotations. I am unable to add a reference to System.ComponentModel as it is not in the list. On my code behind page, I have a 'using System.ComponentModel;' statement. When I try to create a PagedCollectionView such as:
PagedCollectionView taskListView = new PagedCollectionView(taskList);
taskListView.GroupDescriptions.Add(new PropertyGroupDescription("State"));
I get the following error:
The type or namespace name 'PagedCollectionView' could not be found (are you missing a using directive or an assembly reference?)
How do I reference these so I can group data in my DataGrid? Also, does anyone know what the rational was for removing these from the XAML.
Regards
Patrick
推荐答案
您使用的是Silverlight 3吗?
您可能会错过System.Windows.Data.dll
请阅读 http://msdn.microsoft.com/en-us/library/cc645049(VS.95)的.aspx?ppud = 4
<无线电通信/>复制如下:
$
3.10对System.ComponentModel.dll和DataPager的重大更改
这些重大更改已汇总下面:
Are you using Silverlight 3?
You may miss System.Windows.Data.dll
please read http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx?ppud=4
copied below:
3.10 Breaking Changes to System.ComponentModel.dll and the DataPager
These breaking changes are summarized below:
-
System.ComponentModel.dll已被删除。
-
System.ComponentModel.dll has been deleted.
从System.ComponentModel,以下类/接口已移至新的System.Windows.Data.dll(名称空间保持不变):
From System.ComponentModel, the following classes/interfaces have been moved to the new System.Windows.Data.dll (namespaces have remained unchanged):
-
PagedCollectionView
-
PagedCollectionView
这篇关于在DataGrid中对数据进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!