ylbtech-SilverLight-DataControls-PagedCollectionView:The PagedCollectionView(分页的集合视图) 对象 |
- 1.A, Building a Data Object(创建一个数据对象)
- 1.B, Sorting(排序)
- 1.C, Filtering(过滤)
- 1.D, Grouping(分组)
- 1.E, Paging(分页)
1.A, Building a Data Object(创建一个数据对象)返回顶部 |
/Access/Product.cs

4,
1.B, Sorting(排序)返回顶部 |
1,

2,
2.1/3,
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
2.2/3,

2.3/3,
using System.Windows.Controls; using SLYlbtechApp.Access; using System.Windows.Data; namespace SLYlbtechApp.ThePagedCollectionView { public partial class Sorting : UserControl { public Sorting() { InitializeComponent(); PagedCollectionView view = new PagedCollectionView(Product.GetAll()); //排序 view.SortDescriptions.Add(new System.ComponentModel.SortDescription("UnitPrice" , System.ComponentModel.ListSortDirection.Ascending)); view.SortDescriptions.Add(new System.ComponentModel.SortDescription("ProductId" , System.ComponentModel.ListSortDirection.Ascending)); //二次排序 this.gridList.ItemsSource = view; } } }
3,
4,
1.C, Filtering(过滤)返回顶部 |
1,

2,
2.1/3, 同上文 B.2.1/3
2.2/3, 同上文 B.2.2/3
2.3/3,
using System.Windows.Controls; using SLYlbtechApp.Access; using System.Windows.Data; namespace SLYlbtechApp.ThePagedCollectionView { public partial class Filtering : UserControl { public Filtering() { InitializeComponent(); PagedCollectionView view = new PagedCollectionView(Product.GetAll()); //过滤集合 view.Filter = delegate(object filterObject) { Product product = (Product)filterObject; return (product.CategoryName == "饮料"); //只显示 类别名称等于“饮料”的商品 }; this.gridList.ItemsSource = view; } } }
3,
4,
1.D Grouping(分组)返回顶部 |
1,
1.1/2, 一次分组

1.2/2,二次分组

2,
2.1/3, 同上文 B.2.1/3
2.2/3, 同上文 B.2.2/3
2.3/3,
using System.Windows.Controls; using SLYlbtechApp.Access; using System.Windows.Data; namespace SLYlbtechApp.ThePagedCollectionView { public partial class Grouping : UserControl { public Grouping() { InitializeComponent(); PagedCollectionView paged = new PagedCollectionView(Product.GetAll()); //分组 paged.GroupDescriptions.Add(new PropertyGroupDescription("CategoryName")); //paged.GroupDescriptions.Add(new System.Windows.Data.PropertyGroupDescription("UnitPrice")); //二次分组 this.gridList.ItemsSource = paged; } } }
3,
4,
1.E, Paging(分页)返回顶部 |
1,

2,
2.1/3, 同上文 B.2.1/3
2.2/3,

2.3/3,
using System.Windows.Controls; using SLYlbtechApp.Access; using System.Windows.Data; namespace SLYlbtechApp.ThePagedCollectionView { public partial class Paging : UserControl { public Paging() { InitializeComponent(); //分页 PagedCollectionView view = new PagedCollectionView(Product.GetAll()); this.gridList.ItemsSource = view; } } }
3,
4,