Question

Is it possible to specify CollectionViewSource element in the XAML code of my metro application as

<CollectionViewSource x:Name="groupedAppointments" IsSourceGrouped="True"
                      d:Source="{Binding Appointments,
                    Source={d:DesignInstance Type=dataModel:SampleDataSource,
                    IsDesignTimeCreatable=True}}">
    <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="@DateOfVisit" />
      </CollectionViewSource.GroupDescriptions>
</CollectionViewSource>

But VS says

Error   3   The member "GroupDescriptions" is not recognized or is not accessible.

According to msdn CollectionViewSource should have this field. What am I doing wrong?

Was it helpful?

Solution

Here's the doc page for CollectionViewSource for winrt: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.data.collectionviewsource.aspx

The GroupDescriptions property is not available in WinRT

If I remember correctly this should work for you:

<CollectionViewSource x:Name="groupedAppointments" IsSourceGrouped="True"
                      ItemsPath="ThePropertyThatIsGroupedByDateOfVisitGoesHere"
                      d:Source="{Binding Appointments,
                    Source={d:DesignInstance Type=dataModel:SampleDataSource,
                    IsDesignTimeCreatable=True}}">   
</CollectionViewSource>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top