Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
The application contains a set of Button controls.
You need to ensure that a button is highlighted when the mouse pointer is located over a button that contains no content.
Which code fragment should you use?

You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application.
The application contains a set of Button controls.
You need to ensure that a button is highlighted when the mouse pointer is located over a button that contains no content.
Which code fragment should you use?

A.
<Style TargetType=”{x:Type Button}”> …
<Setter Property=”Background” Value=”Yellow” />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property=”IsMouseOver” Value=”True” />
<Condition Property=”Content” Value=”{x:Null}” />
</MultiTrigger.Conditions>
</MultiTrigger> </Style.Triggers>
</Style>

B.
<Style TargetType=”{x:Type Button}”> …
<Style.Triggers>
<Trigger Property=”IsMouseOver” Value=”True”>
<Setter Property=”Background” Value=”Yellow” />
</Trigger>
<Trigger Property=”Content” Value=”{x:Null}”>
<Setter Property=”Background” Value=”Yellow” />
</Trigger>
</Style.Triggers> </Style>

C.
<Style TargetType=”{x:Type Button}”> …
<Setter Property=”Background” Value=”Yellow” />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property=”IsMouseOver” Value=”True” />
<Condition Property=”Content” Value=”Empty” />
</MultiTrigger.Conditions>
</MultiTrigger>
</Style.Triggers>
</Style>

D.
<Style TargetType=”{x:Type Button}”> …
<Style.Triggers>
<Trigger Property=”IsMouseOver” Value=”True”>
<Setter Property=”Background” Value=”Yellow” />
</Trigger>
<Trigger Property=”Content” Value=”Empty”>
<Setter Property=”Background” Value=”Yellow” />
</Trigger>
</Style.Triggers>
</Style>



Leave a Reply 0

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