I am using Silverlight RIA with EF and I have an entity with e.g. fields Date, Field1, Field2, …
Binding the data on LoadOperation_Completed works fine. However, I need to group the data by Year, Month, Week. What is the proposed method? I’ve tried
public void loadOp_Completed(object sender, EventArgs e) {
LoadOperation<MyEntity> loadOp = sender as LoadOperation<MyEntity>;
List<MyEntity> list = ((LoadOperation<MyEntity>)sender).Entities.ToList();
PagedCollectionView collection = new PagedCollectionView(list);
collection.GroupDescriptions.Add(new PropertyGroupDescription(**???**));
this.MyDataGrid.ItemsSource = collection;
}
but I don’t know what my PropertyGroupDescription should be.
Thank you in advance
Add properties called
Year,MonthandWeekand base them on your date field:Then group by Year, Month, Week 🙂