Exam 70-511 : Windows Applications Development with Microsoft .NET Framework 4 Part – 11

Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
<Window x:Class="MyProject.MainWindow" xmlns:local="clr-namespace:MyProject">
<Window.Resources>
<local:MyConverter x:Key="myConverter" />
</Window.Resources>
<ListBox Name="box">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource myConverter}, ConverterParameter=formatText}" Background="{Binding Converter={StaticResource myConverter}, ConverterParameter=formatColor}" IsEnabled="{Binding Converter={StaticResource myConverter}}" />
</DataTemplate> </ListBox.ItemTemplate>
</ListBox> </Window>

You need to implement the MyProject.MyConverter class. What should you do?

  1. Implement the IValueConverter interface.
  2. Implement the IMultiValueConverter interface.
  3. Inherit from the TypeConverter class.
  4. Apply the TypeConverterAttribute attribute.

Correct Answer: 1


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You write the following code fragment.
<Window x:Class="MyProject.MainWindow" xmlns:local="clr-namespace:MyProject">
<Window.Resources>
<local:AverageConverter x:Key="avgConverter" />
</Window.Resources>
<StackPanel Orientation="Vertical">
<Slider x:Name="sld01" Minimum="0" Maximum="100" />
<Slider x:Name="sld02" Minimum="0" Maximum="50" />
<Slider x:Name="sld03" Minimum="0" Maximum="50" />
<TextBlock> <TextBlock.Text>
<MultiBinding Converter="{StaticResource avgConverter}">
<Binding ElementName="sld01" Path="Value" />
<Binding ElementName="sld02" Path="Value" />
<Binding ElementName="sld03" Path="Value" />
</MultiBinding> </TextBlock.Text>
</TextBlock> </StackPanel> </Window>

You need to implement the MyProject.AverageConverter class. What should you do?

  1. Implement the IValueConverter interface.
  2. Implement the IMultiValueConverter interface.
  3. Inherit from the TypeConverter class.
  4. Apply the TypeConverterAttribute attribute.

Correct Answer: 2


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a ListBox control to the application. The ListBox control is data-bound to an instance of a custom collection class of the Product objects named ProductList. The number of items of the data-bound collection is fixed. However, users can modify the properties of each of the Product objects in the collection. You need to ensure that changes made on the Product objects are automatically reflected in the ListBox control. What should you do?

  1. Implement the INotifyPropertyChanged interface in the Product class.
  2. Implement the INotifyCollectionChanged interface in the ProductList class.
  3. Set the Mode property of the Binding object of the ListBox control to TwoWay.
  4. Set the UpdateSourceTrigger property of the Binding object of the ListBox control to PropertyChanged.

Correct Answer: 1


Question: You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You add a ListBox control to the application. The ListBox control is data-bound to an instance of a custom collection class of the Product objects named ProductList. You need to ensure that changes to ProductList are automatically reflected in the ListBox control. What should you do?

  1. Implement the INotifyPropertyChanged interface in the Product class.
  2. Implement the IQueryable<Product> interface in the ProductList class.
  3. Extend the DependencyObject class in the Product class.
  4. Extend the ObservableCollection<Product> class in the ProductList class.

Correct Answer: 4


Question: 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?

  1. <CollectionViewSource.GroupDescriptions> <swd:PropertyGroupDescription PropertyName="State"/>
    </CollectionViewSource.GroupDescriptions>
    <CollectionViewSource.SortDescriptions>
    <scm:SortDescription PropertyName="State" Direction="Descending"/>
    <scm:SortDescription PropertyName="Name" Direction="Ascending" />
    </CollectionViewSource.SortDescriptions>
  2. <CollectionViewSource.GroupDescriptions>
    <swd:PropertyGroupDescription PropertyName="Name"/>
    </CollectionViewSource.GroupDescriptions>
    <CollectionViewSource.SortDescriptions>
    <scm:SortDescription PropertyName="Name" Direction="Ascending" />
    <scm:SortDescription PropertyName="State" Direction="Descending"/>
    </CollectionViewSource.SortDescriptions>
  3. <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>
  4. <CollectionViewSource.GroupDescriptions>
    <swd:PropertyGroupDescription PropertyName="State"/>
    </CollectionViewSource.GroupDescriptions>
    <CollectionViewSource.SortDescriptions>
    <scm:SortDescription PropertyName="State" Direction="Descending"/>
    <scm:SortDescription PropertyName="Name" Direction="Ascending" />
    </CollectionViewSource.SortDescriptions>

Correct Answer: 1

Tagged . Bookmark the permalink.

Leave a Reply