[英]Entity Framework 4 - Sorting by foreign entity
我懂了
'System.Windows.Data.BindingListCollectionView' view does not support sorting
當我使用以下CollectionViewSource時:
<CollectionViewSource Source="{Binding Path=CourseSessions}" x:Key="cvsCourses">
<CollectionViewSource.SortDescriptions>
<ComponentModel:SortDescription PropertyName="StartDate"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
DataContext是一個ObservableCollection<Course>
。 我正在使用Entity Framework 4,CourseSessions是Course的屬性:
public ObjectSet<CourseSession> CourseSessions
在這種情況下,如何對排序進行排序,而不對從數據庫中出來的數據進行排序?
我認為問題在於ObjectSet不支持排序。 請看看Nicholas Romanidis的這篇文章: 使用CollectionViewSource顯示按主從排序的EntityCollections
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.