What should you do to ensure that the check box displays the text “Is Active No” in the cleared state?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You plan to add a check box to a window of the application. The check box must display the associated content and the text "Yes" or "No" instead of the check mark. You write the following XAML code fragment. (Line numbers are included for reference only.)

01 <Window.Resources>
02 <ControlTemplate x:Key="check" TargetType="CheckBox">
03 <DockPanel Name="dock">
04
05 <TextBlock Name="text"/>
06 </DockPanel>
07 <ControlTemplate.Triggers>
08 <Trigger Property="IsChecked" Value="False">
09
10 </Trigger>
11 </ControlTemplate.Triggers>
12 </ControlTemplate>
13 </Window.Resources>
14 <CheckBox Content="Is Active" Template="{StaticResource check}" />

You need to ensure that the check box displays the text "Is Active No" in the cleared state.
What should you do?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You plan to add a check box to a window of the application. The check box must display the associated content and the text “Yes” or “No” instead of the check mark. You write the following XAML code fragment. (Line numbers are included for reference only.)

01 <Window.Resources>
02 <ControlTemplate x:Key=”check” TargetType=”CheckBox”>
03 <DockPanel Name=”dock”>
04
05 <TextBlock Name=”text”/>
06 </DockPanel>
07 <ControlTemplate.Triggers>
08 <Trigger Property=”IsChecked” Value=”False”>
09
10 </Trigger>
11 </ControlTemplate.Triggers>
12 </ControlTemplate>
13 </Window.Resources>
14 <CheckBox Content=”Is Active” Template=”{StaticResource check}” />

You need to ensure that the check box displays the text “Is Active No” in the cleared state.
What should you do?

A.
Insert the following XAML code fragment at line 04.
<ContentPresenter />
Insert the following XAML code fragment at line 09.
<Setter TargetName=”text” Property=”Text” Value=”No”/>

B.
Insert the following XAML code fragment at line 04.
<ContentPresenter />
Insert the following XAML code fragment at line 09.
<Setter Property=”TextBlock.Text” Value=”No”/>

C.
Insert the following XAML code fragment at line 04.
<ContentPresenter Content=”{TemplateBinding Content}” />
Insert the following XAML code fragment at line 09.
<Setter Property=”TextBlock.Text” Value=”No”/>

D.
Insert the following XAML code fragment at line 04.
<ContentPresenter Content=”{Binding RelativeSource={RelativeSource this}, Path=Content}” />
Insert the following XAML code fragment at line 09.
<Setter TargetName=”text” Property=”Text” Value=”No”/>



Leave a Reply 0

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