using Icomparer to sort with special condition
In my project i have a need to sort the datagrid column but if a certain 开发者_如何学编程condition holds true for an item it should be at the top(first item) of the sorted list. otherwise if that condition does not hold for any item it should be simple sorted list.
I tries using sorting event and defining iComparer but i could not manage to get the desired behavior. What code will i put in Icomparer so that it can return the item with condition a true at the top and rest item in sorted fashion.
please can someone help
It sounds like you want to sort by the "certain condition" an then by the other sort critiria. This should just be a case of prepending condition to the list of sort descriptions in the CollectionView.
精彩评论