|
-
October 15th, 2010, 05:02 AM
#13
Re: Menu Item color change in wpf
Hi guys,
Basically I've got the same question. I applied the suggested fix 'inline' as below:
Code:
<Menu Name="menu1" Width="125" BorderThickness="2"
BorderBrush="Gray" FontSize="16" FontStyle="Italic" Background="Transparent">
<MenuItem Header="MENU" Foreground="White" VerticalAlignment="Center"
Margin="-70,0,0,0" Height="24" Padding="6,3" Width="100"
Background="Transparent" Name="Item1">
<MenuItem.Style>
<Style TargetType="{x:Type MenuItem}">
<Style.Triggers>
<Trigger Property="IsHighlighted" Value="True" >
<Setter Property="Background" Value="Yellow" />
<Setter Property="FontStyle" Value="Italic" />
</Trigger>
</Style.Triggers>
</Style>
</MenuItem.Style>
<MenuItem Header="Component Data">
.
.
.
and so on...
For some reason, putting this style right into the element code doesn't seem to be working. I can go ahead do the full-blown template if need be. Maybe that will be useful later, but I'd certainly like to just be able to just put this small bit of code in and get it working quickly. Will putting the style directly into the element definition like this work? Or is a template referenced via a resource the only way a Trigger is recognized?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|