Which XAML fragment should you use?

You are developing a Silverlight 4 application. The application defines the following three event handlers.
(Line numbers are included for reference only.)

01 private void HandleCheck(object sender, RoutedEventArgs e)
02 {
03 MessageBox.Show(“Checked”);
04 }
05
06 private void HandleUnchecked(object sender, RoutedEventArgs e)
07 {
08 MessageBox.Show(“Unchecked”);
09 }
10
11 private void HandleThirdState(object sender, RoutedEventArgs e)
12 {
13 MessageBox.Show(“Indeterminate”);
14 }

You need to allow a check box that can be selected, cleared, or set to Indeterminate. You also need to ensure that the event handlers are invoked when the user changes the state of the control. Which XAML fragment should you use?

You are developing a Silverlight 4 application. The application defines the following three event handlers.
(Line numbers are included for reference only.)

01 private void HandleCheck(object sender, RoutedEventArgs e)
02 {
03 MessageBox.Show(“Checked”);
04 }
05
06 private void HandleUnchecked(object sender, RoutedEventArgs e)
07 {
08 MessageBox.Show(“Unchecked”);
09 }
10
11 private void HandleThirdState(object sender, RoutedEventArgs e)
12 {
13 MessageBox.Show(“Indeterminate”);
14 }

You need to allow a check box that can be selected, cleared, or set to Indeterminate. You also need to ensure that the event handlers are invoked when the user changes the state of the control. Which XAML fragment should you use?

A.
<CheckBox x:Name=”cb2″ Content=”Three State CheckBox” IsChecked=”True” Checked=”Handle Check “Indeterminate = “Handle Unchecked” Unchecked = “Handle Unchecked” />

B.
<CheckBox x:Name=”cb2″ Content=”Three State CheckBox” IsThreeState=”True” Checked=”HandleCheck” Indeterminate = “Handle Third State” Unchecked =”Handle Unchecked” />

C.
<CheckBox x:Name=”cb2″ Content=”Three State Check Box” Is HitT est Visible =”True” Checked =”Handle Check” Indeterminate =”Handle Third State” Unchecked=”HandleUnchecked” />

D.
<CheckBox x:Name=”cb2″ Content=”Three State CheckBox” IsEnabled=”True” Checked=”Handle Check” Indeterminate =”Handle Unchecked” Unchecked =”Handle Unchecked” />



Leave a Reply 0

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