wpf - Own CollectionView for paging, sorting and filtering -


i've implemented own collectionview bind collection of data datagrid in wpf.

the main goal pagination, working quite well. i've written following c# code:

public class schemescollectionview : collectionview {     private readonly ilist<scheme> innerlist;     private readonly int itemsperpage;      private int currentpage = 1;      public schemescollectionview(ilist<scheme> source, int itemsperpage)         : base(source)     {         innerlist = source;         this.itemsperpage = itemsperpage;     }      public override int count     {         { return itemsperpage; }     }      public int currentpage     {         { return currentpage; }         set         {             currentpage = value;             onpropertychanged(new propertychangedeventargs("currentpage"));             onpropertychanged(new propertychangedeventargs("firstitemnumber"));             onpropertychanged(new propertychangedeventargs("lastitemnumber"));         }     }      public int itemsperpage { { return this.itemsperpage; } }      public int pagecount     {                 {             return (this.innerlist.count() + this.itemsperpage - 1)                 / this.itemsperpage;         }     }      public int lastitemnumber     {                 {             var end = currentpage * itemsperpage - 1;             end = (end > innerlist.count()) ? innerlist.count() : end;              return end + 1;         }     }      public int startindex     {         { return (currentpage - 1) * itemsperpage; }     }      public int firstitemnumber     {         { return ((currentpage - 1) * itemsperpage) + 1; }     }      public override object getitemat(int index)     {         var offset = index % (itemsperpage);          var position = startindex + offset;          if (position >= innerlist.count)         {             position = innerlist.count - 1;         }          return innerlist[position];     }      public void movetonextpage()     {         if (currentpage < pagecount)         {             currentpage += 1;         }         refresh();     }      public void movetopreviouspage()     {         if (currentpage > 1)         {             currentpage -= 1;         }         refresh();     }      public void movetofirstpage()     {         currentpage = 1;         refresh();     }      public void movetolastpage()     {         currentpage = pagecount;         refresh();     } } 

as mentioned, pagination works well. can't filtering , sorting work. when add custom filter filter property, gets ignored. same sorting. can see arrows on column headers after clicked them, different sorting not reflected within datagrid.

what i'm missing here? hope can help.

as mentioned in this, can take code silverlight , use in wpf.

paged collection view in wpf


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -