0

我在视图模型中使用 DCV 作为属性。一切正常,但自定义排序呢?假设我的模型中有一个字符串属性,应该按字母数字排序。我怎样才能做到这一点?

升级版:

模型:

public class MyModel
{
///...
public SomeProperty {get;set;}
}

xml:

<data:DataTextColumn Binding={binding path=SomeProperty}, canusersort=true />

在数据网格中排序时,属性被排序而不考虑字母数字顺序,即以常规字符串方式。我想应用我的自定义排序,例如通过引入我自己的 IComparer。至少据我所知,没有可用的 API。有什么线索吗?

4

1 回答 1

1

DomainCollectioView 有特殊的集合:

排序描述

您可以在您的 ViewModel 中添加下一个代码:

DCV.SortDescriptions.Add(new SortDescription("SomeProperty ", ListSortDirection.Ascending));
于 2012-10-09T12:33:59.000 回答