Question

This is a real newbie question. I feel dumb that I have not figured it out yet. I am trying to add a sort to my CollectionViewSource in my Win 8 App.

    <CollectionViewSource
        x:Name="itemsViewSource"
        x:Key="cvs"
        Source="{Binding Items}">

        <CollectionViewSource.SortDescriptions>
            <scm:SortDescription PropertyName="PubDate" Direction="Ascending"/>
        </CollectionViewSource.SortDescriptions>

    </CollectionViewSource>

I have the following namespaces declared: xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"

But I get the error "Unknown member 'SortDescriptions' on element 'CollectionViewSource'" when I try to build. What am I missing?

Was it helpful?

Solution

I believe that CollecitonViewSource in WinRT does not have SortDescription. You may have to order the Items instead.

This link might help as well.

A WinRT CollectionView class with Filtering and Sorting

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top