如何实现接口IPagedCollectionView

时间:2016-01-29 08:43:32

标签: c# silverlight interface paging

我有一个DataPager,我正在进行自定义分页。我想根据返回的总ItemCount的{​​{1}}设置DataPager的{​​{1}}属性。但我发现COUNT属于rows属性。我怎么能ItemCount呢?任何出路?

包含read-only属性

set接口
IPagedCollectionView

2 个答案:

答案 0 :(得分:0)

因为计算(总)计数的逻辑应该封装在类

public int ItemCount
{
   get { return YOURCALCULATIONMETHOD(); }
}

答案 1 :(得分:0)

有一种方法,但我不确定你想这样做。

我在Silverlight中不擅长但理论上你需要创建继承自IPagedCollectionView

的类
public class MyPagedCollectionView : IPagedCollectionView 
{
 public int ItemCount
 {
    get { return this.GetItemCount(); }
 }
 public int TotalItemCount
 {
    get {  return this.GetTotalItemCount(); }
 }

 private int GetTotalItemCount()
 {
     //  Implement the method
 }

 private int GetItemCount()
 {
  //  Implement the method
 }

}
相关问题