menu style

Jan 19, 2009 at 3:50 PM
How can I create a style for a menu and menu item? Can anyone show me a XAML example? Thaks.
Jan 19, 2009 at 7:52 PM
Sure.  Here is a quick example of just changing Backgrounds.  I just threw this together in XamlPad so if you need something more complex just ask.

<Page xmlns="" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="" >
<Style x:Key="YellowMIBG" TargetType="MenuItem">
 <Setter Property="Background" Value="Yellow"/>
<Style x:Key="BlueMIBG" TargetType="MenuItem">
 <Setter Property="Background" Value="Blue"/>
<Style x:Key="PurpleMBG" TargetType="Menu">
 <Setter Property="Background" Value="Purple"/>
<Menu Style="{StaticResource PurpleMBG}">
 <MenuItem Header="File">
  <MenuItem Header="Hello World" Style="{StaticResource YellowMIBG}"/>
  <MenuItem Header="World, Hello" Style="{StaticResource BlueMIBG}"/>
Jan 21, 2009 at 7:30 AM

Thank you very much.

How do you change other properties - for example the color of text and background on mouse over?