问题
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