问题描述
在使用datagrid的silverlight项目中,我使用一些定义标签号的列,这是一个Varchar。我想按照或以任何可能的方式描述在
http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting中描述的自然排序顺序。
当我查看datagrid时,我看到SortMemberPath =stringProperty。因此,我的排序只是像字符串排序一样工作。例如:
Z1
Z10
Z2
Z20
我希望将其排序如下:
Z1
Z2
Z10
Z20
在这方面提出建议将是非常有帮助的。
对于ObservableCollection<> ...的自然排序,使用链接中定义的类来比较Collection的每一行()并刷新与datagrid绑定。这很有效。
In silverlight project that uses datagrid, I am using some column that defines "Label number" which is a Varchar.
I want to sort this column as described in natural sort order as described in "http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting" or any possible way.
When I look around datagrid I saw SortMemberPath="stringProperty" only. Hence, my sorting is just working like string sorting only. For example:
Z1
Z10
Z2
Z20
where as I want it to sort like:
Z1
Z2
Z10
Z20
It will be of great help to have suggestion on this regard.
For Natural sorting of ObservableCollection<> ..., Compare each row of the Collection using class defined in link(http://www.interact-sw.co.uk/iangblog/2007/12/13/natural-sorting) and refresh the binding with datagrid. That worked.
这篇关于如何实现自然(人类字母数字)排序,对于Silverlight datagrids使用ViewModel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!