1

私は得る

'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

この場合、データベースから出てくるデータを並べ替える以外に、どのように並べ替えを指定できますか?

4

1 に答える 1

0

問題は、ObjectSet が並べ替えをサポートしていないことだと思います。Nicholas Romanidis によるこの記事をご覧ください: CollectionViewSource を使用して、Master-Detail で並べ替えられた EntityCollections を表示する

于 2011-01-03T15:48:48.797 に答える