Which code fragment should you insert at line 04?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You create a class named Person that has a FirstName property and a LastName property.
You create a resource that contains a collection of Person objects and assign the family key to it.
You add a ListBox control by using the following code fragment. (Line numbers are included for reference only.)
01<ListBox ItemsSource=”{StaticResource family}”>
02<ListBox.ItemTemplate>
03<DataTemplate>
04
05</DataTemplate>
06</ListBox.ItemTemplate>
07</ListBox>
You need to ensure that each item in the ListBox control meets the following requirements:
* Contains a TextBox that is data-bound to the FirstName property.
* Contains a TextBox that is data-bound to the LastName property.
Which code fragment should you insert at line 04?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
You create a class named Person that has a FirstName property and a LastName property.
You create a resource that contains a collection of Person objects and assign the family key to it.
You add a ListBox control by using the following code fragment. (Line numbers are included for reference only.)
01<ListBox ItemsSource=”{StaticResource family}”>
02<ListBox.ItemTemplate>
03<DataTemplate>
04
05</DataTemplate>
06</ListBox.ItemTemplate>
07</ListBox>
You need to ensure that each item in the ListBox control meets the following requirements:
* Contains a TextBox that is data-bound to the FirstName property.
* Contains a TextBox that is data-bound to the LastName property.
Which code fragment should you insert at line 04?

A.
<TextBox Text=”{Binding FirstName}” />
<TextBox Text=”{Binding LastName}” />

B.
<TextBox Text=”{Binding Path=FirstName, Source=DataItem}” />
<TextBox Text=”{Binding Path=LastName, Source=DataItem}” />

C.
<TextBox Text=”{Binding DataItem.FirstName}” />
<TextBox Text=”{Binding DataItem.LastName}” />

D.
<TextBox Text=”{PriorityBinding StringFormat=FirstName}” />
<TextBox Text=”{PriorityBinding StringFormat=LastName}” />



Leave a Reply 0

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