Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You add a ListBox to show grouped data.
The ListBox is data-bound to a collection of items. Each item has the Name and State properties.
You need to ensure that the ListBox meets the following requirements:
* Names grouped by State
* Names sorted in ascending order
* States sorted in descending order
Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You add a ListBox to show grouped data.
The ListBox is data-bound to a collection of items. Each item has the Name and State properties.
You need to ensure that the ListBox meets the following requirements:
* Names grouped by State
* Names sorted in ascending order
* States sorted in descending order
Which code fragment should you use?

A.
<CollectionViewSource.GroupDescriptions>
<swd:PropertyGroupDescription PropertyName=”State”/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName=”State” Direction=”Descending”/>
<scm:SortDescription PropertyName=”Name” Direction=”Ascending” />
</CollectionViewSource.SortDescriptions>

B.
<CollectionViewSource.GroupDescriptions>
<swd:PropertyGroupDescription PropertyName=”Name”/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName=”Name” Direction=”Ascending” />
<scm:SortDescription PropertyName=”State” Direction=”Descending”/>
</CollectionViewSource.SortDescriptions>

C.
<CollectionViewSource.GroupDescriptions>
<swd:PropertyGroupDescription PropertyName=”State”/>
<swd:PropertyGroupDescription PropertyName=”Name”/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName=”State” Direction=”Descending”/>
<scm:SortDescription PropertyName=”Name” Direction=”Ascending” />
</CollectionViewSource.SortDescriptions>

D.
<CollectionViewSource.GroupDescriptions>
<swd:PropertyGroupDescription PropertyName=”State”/>
</CollectionViewSource.GroupDescriptions>
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName=”State” Direction=”Descending”/>
<scm:SortDescription PropertyName=”Name” Direction=”Ascending” />
</CollectionViewSource.SortDescriptions>



Leave a Reply 0

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