我在xaml中定义了一个SortDescriptions,如下所示: -
<scm:SortDescriptionCollection x:Key="sortDescriptors">
<scm:SortDescription PropertyName="Description" />
<scm:SortDescription PropertyName="Id" />
</scm:SortDescriptionCollection>
我如何在CollectionViewSource中引用它: -
<CollectionViewSource x:Key="csv" Source="{Binding DataContext}" >
<CollectionViewSource.SortDescriptions>
<!- how to reference it here ->
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
我有多个CollectionViewSource,我想在它们之间共享sortDescriptors。
答案 0 :(得分:0)
像这样:
<CollectionViewSource x:Key="csv" Source="{Binding DataContext}" >
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Description"/>
<scm:SortDescription PropertyName="Id"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>