Win8 / XAML排序CollectionViewSource

时间:2014-04-17 00:59:31

标签: c# xaml windows-8

我正在尝试对CollectionViewSource进行排序。我尝试过SortDescriptions,但是它会产生一个未知的成员错误(即使在添加引用之后)

    <common:LayoutAwarePage.Resources>

<common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

    <!--
        Collection of grouped items displayed by this page, bound to a set
        of the complete item list because items in groups cannot be virtualized
    -->
    <!--Replace d:Source... with the following to obtain data from the actual Azure Service-->
    <!--Source="{Binding ItemGroups, Source={d:DesignInstance IsDesignTimeCreatable=True, Type=ViewModels:ItemsShowcaseViewModel}}"-->
    <CollectionViewSource
        x:Name="groupedItemsViewSource"
        Source="{Binding ItemGroups}"
        d:Source="{Binding ItemGroups, Source={d:DesignInstance IsDesignTimeCreatable=True, Type=sampleData:ItemsShowcaseSampleData}}" IsSourceGrouped="True" 
        >


    </CollectionViewSource>


</common:LayoutAwarePage.Resources>

1 个答案:

答案 0 :(得分:1)

在WinRT / XAML中,排序不会内置到CollectionViewSource中。您需要在数据/视图模型中对数据进行排序。