Which XAML fragment should you replace at lines 03 and 04?

You are developing a Silverlight 4 application. The application contains a Car class that implements the INotifyPropertyChangedinterface.Theapplication also has a public ObservableCollection<string> property named Tires and a public string property named SelectedTire. The application has a user control that contains the following XAML fragment.
(Line numbers are included for reference only.)

01 <UserControl>
02 <StackPanel>
03 <ListBox ItemsSource=”{Binding Path=Tires}” />
04 <TextBox Text=”{Binding Path=SelectedTire}” />
05 </StackPanel>
06 </UserControl>

You need to modify the user control to meet the following requirements:
When the selected item in the ListBox is changed, the SelectedTire property in the Car class is updated.
When no item is selected in the ListBox, the text in the TextBox is set to “No value selected.”
When the text in the TextBox is changed to a valid entry in the Tires collection, the selected item in the ListBox is changed.
Which XAML fragment should you replace at lines 03 and 04?

You are developing a Silverlight 4 application. The application contains a Car class that implements the INotifyPropertyChangedinterface.Theapplication also has a public ObservableCollection<string> property named Tires and a public string property named SelectedTire. The application has a user control that contains the following XAML fragment.
(Line numbers are included for reference only.)

01 <UserControl>
02 <StackPanel>
03 <ListBox ItemsSource=”{Binding Path=Tires}” />
04 <TextBox Text=”{Binding Path=SelectedTire}” />
05 </StackPanel>
06 </UserControl>

You need to modify the user control to meet the following requirements:
When the selected item in the ListBox is changed, the SelectedTire property in the Car class is updated.
When no item is selected in the ListBox, the text in the TextBox is set to “No value selected.”
When the text in the TextBox is changed to a valid entry in the Tires collection, the selected item in the ListBox is changed.
Which XAML fragment should you replace at lines 03 and 04?

A.
<ListBox ItemsSource=”{Binding Path=Tires}” SelectedItem=”{Binding Path=SelectedTire}” />
<TextBox Text=”{Binding Path=SelectedTire, TargetNullValue=’No value selected’, Mode=Two Way}” />

B.
<ListBox ItemsSource=”{Binding Path=Tires}” SelectedItem=”{Binding Path=SelectedTire, Mode=TwoWay}” />
<TextBox Text=”{Binding Path=SelectedTire, TargetNullValue=’No value selected’, Mode=Two Way}” />

C.
<ListBox ItemsSource=”{Binding Path=Tires}” SelectedItem=”{Binding Path=SelectedTire, Mode=TwoWay}” />
<TextBox Text=”{Binding Path=SelectedTire, Mode=TwoWay}” />

D.
<ListBox ItemsSource=”{Binding Path=Tires}” SelectedItem=”{Binding Path=SelectedTire, Mode=TwoWay}” />
<TextBox Text=”{Binding Path=SelectedTire, TargetNullValue=’No value selected’}” />



Leave a Reply 0

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