0

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

Fatema
  • 135
  • 1
  • 10
  • I think you should show your code and tell us, what is not working as expected. – Daniel Hilgarth Feb 23 '11 at 12:56
  • I need a sorting logic for above condition. first i thought i would sort the listviewcollection and then remove and insert the desired item at the first place. but it turns out that listviewcollection does not support insert option. so i am stuck. – Fatema Feb 23 '11 at 13:13

1 Answers1

0

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.

mancaus
  • 2,983
  • 1
  • 20
  • 18