Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application contains a class named Place that has the following attributes:
* CityName: a string value that represents the name of a city
* State: a string value that represents the name of a state
* The application also has a collection of Place objects named places.
You need to create a Collection View on the places collection that meets the following requirements:
* The view is grouped by the state name.
* The view is sorted by the city name.
Which XAML code fragment should you use?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
The application contains a class named Place that has the following attributes:
* CityName: a string value that represents the name of a city
* State: a string value that represents the name of a state
* The application also has a collection of Place objects named places.
You need to create a Collection View on the places collection that meets the following requirements:
* The view is grouped by the state name.
* The view is sorted by the city name.
Which XAML code fragment should you use?

A.
<Window.Resources>
<src:Places x:Key="places"/>
<CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyValue="CityName"/>
</CollectionViewSource.SortDescriptions>
<CollectionViewSource.GroupDescriptions>
<dat:PropertyGroupDescription PropertyValue="State"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>

B.
<Window.Resources>
<src:Places x:Key="places"/>
<CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="State"/>
</CollectionViewSource.SortDescriptions>
<CollectionViewSource.GroupDescriptions>
<dat:PropertyGroupDescription PropertyName="CityName"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>

C.
<Window.Resources>
<src:Places x:Key="places"/>
<CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="CityName"/>
</CollectionViewSource.SortDescriptions>
<CollectionViewSource.GroupDescriptions>
<dat:PropertyGroupDescription PropertyName="State"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>

D.
<Window.Resources>
<src:Places x:Key="places"/>
<CollectionViewSource Source="{StaticResource places}" x:Key="cvs">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyValue="State"/>
</CollectionViewSource.SortDescriptions>
<CollectionViewSource.GroupDescriptions>
<dat:PropertyGroupDescription PropertyValue="CityName"/>
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</Window.Resources>



Leave a Reply 0

Your email address will not be published. Required fields are marked *