Microsoft Exam Questions

Which markup segment should you insert at line 05 ?

You are developing a Windows Presentation Foundation (WPF) application that display pricing and inventory.

List box’s ItemsSource property has decimal and string types. Decimals represent price and strings represents the folowing markup is defined as follows.

<Window xmlns:clr=”clr-namespace:System;assembly=mscorlib”>
<ListBox ItemsSource=”{Binding}”>
<ListBox.Resources>

</ListBox.Resources>
</ListBox>
</Window>

You need to ensure that data templates are used to format the strings without changes and the decimals as ..

Which markup segment should you insert at line 05 ?

A.
<DataTemplate x:Key=”clr:String”>
<TextBlock Text=”{Binding StringFormat=Item Error: {0}}”/>
</DataTemplate>
<DataTemplate x:Key=”clr:Decimal”>
<TextBlock Text=”{Binding StringFormat=Item Price: {0:C}}”/>
</DataTemplate>

B.
<DataTemplate x:Key=”String” Template=”clr:String”>
<TextBlock Text=”{Binding StringFormat=Item Error: {0}}”/>
</DataTemplate>
<DataTemplate x:Key=”Decimal” Template=”clr:Decimal”>
<TextBlock Text=”{Binding StringFormat=Item Price: {0:C}}”/>
</DataTemplate>

C.
<DataTemplate DataType=”{x:Type clr:String}”>
<TextBlock Text=”{Binding StringFormat=Item Error: {0}}”/>
</DataTemplate>
<DataTemplate DataType=”{x:Type clr:Decimal}”>
<TextBlock Text=”{Binding StringFormat=Item Price: {0:C}}”/>
</DataTemplate>

D.
<DataTemplate DataType=”clr:String”>
<TextBlock Text=”{Binding StringFormat=Item Error: {0}}”/>
</DataTemplate>
<DataTemplate DataType=”clr:Decimal”>
<TextBlock Text=”{Binding StringFormat=Item Price: {0:C}}”/>
</DataTemplate>