How to achieve Natural(human alpha-numeric ) Sorting, for silverlight datagrids using ViewModel?

╄→гoц情女王★ 提交于 2019-12-08 03:00:02

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/4030761/how-to-achieve-naturalhuman-alpha-numeric-sorting-for-silverlight-datagrids

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!