What do you do to ensure that the following requirements are met?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You write the following XAML code fragment.
(Line numbers are included for reference only.)

01 <StackPanel>
02 <StackPanel.Resources>
03 <Style TargetType="{x:Type Button}">
04
05 </Style>
06 </StackPanel.Resources>
07 …
08 </StackPanel>

You add three buttons to the StackPanel control. You need to ensure that the following requirements are met:
* The background color of each button turns green when the user moves the mouse pointer over the button.
* The background color of each button turns red when the user moves the mouse pointer away from the button.
What should you do?

You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You write the following XAML code fragment.
(Line numbers are included for reference only.)

01 <StackPanel>
02 <StackPanel.Resources>
03 <Style TargetType=”{x:Type Button}”>
04
05 </Style>
06 </StackPanel.Resources>
07 …
08 </StackPanel>

You add three buttons to the StackPanel control. You need to ensure that the following requirements are met:
* The background color of each button turns green when the user moves the mouse pointer over the button.
* The background color of each button turns red when the user moves the mouse pointer away from the button.
What should you do?

A.
Insert the following XAML code fragment at line 04.
<Setter Property=”Background” Value=”Red”/>
<Style.Triggers>
<Trigger Property=”IsMouseOver” Value=”True”>
<Setter Property=”Background” Value=”Green”/>
</Trigger>
</Style.Triggers>

B.
Insert the following XAML code fragment at line 04.
<Setter Property=”Background” Value=”Red”/>
<Style.Triggers>
<Trigger Property=”IsMouseDirectlyOver” Value=”True”>
<Setter Property=”Background” Value=”Green”/>
</Trigger>
</Style.Triggers>

C.
Insert the following XAML code fragment at line 04.
<Style.Triggers>
<Trigger Property=”IsMouseOver” Value=”True”>
<Setter Property=”Background” Value=”Green”/>
</Trigger>
</Style.Triggers>
Set the Background property of each Button control to red.

D.
Insert the following XAML code fragment at line 04.
<Style.Triggers>
<Trigger Property=”IsMouseDirectlyOver” Value=”True”>
<Setter Property=”Background” Value=”Green”/>
</Trigger>
</Style.Triggers>
Set the Background property of each Button control to red.



Leave a Reply 0

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