sorting - Sort Item in ListView by Attribute Windows phone 8.1 RT -
i want sort item in listview attribute. it's not working. try
lview.orderby(p=>p.attribute); list<object> lvnew = lview.itemssource list<object>; lvnew.sort(story.cmp_new); public static int cmp_new(story a, story b) { return (int16.parse(a.storyid) > int16.parse(b.storyid)) ? 0 : 1; }
help me friend
i know i'm late if can : sort list of objects have extends object's class icomparable
add method in class :
public int compareto(object obj) { var second = obj yourclass; return yourattribute.compareto(second.yourattribute); }
last, have call sort
method on yout list :
list<yourclass> mylist = ... mylist.sort();
Comments
Post a Comment