尝试使用
CollectionViewSource
把这个绑在你的组合框上。CollectionViewSource提供排序、分组和筛选。
作为CollectionViewSource的源设置EntitySet。可以将CollectionViewSource添加到任何控件的资源部分。
<CollectionViewSource Source="{StaticResource Things}" x:Key="cvs"> <!--The source can be set in procedural code-->
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Name"/> <!--The name of the property to sort items-->
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<!--The prefix scm mappes to the System.ComponentModel-->
我没有测试过,但它应该可以用。CollectionViewSource的属性源属于Object类型。不知道该对象是否需要实现指定的接口,如IEnumerable。