MenuItem as a radio / options listIs it possible to make a series of MenuItem's behave like a radio button list?<br>The effect that I want is the same as that in Windows Explorer under the View menu for List/Tiles/Details selection - a dot is placed against the selected item on the left hand margin and only one item may be selected at any one time.<br><br>I can set MenuItem.IsCheckable=true which will turn a MenuItem into a checkbox - that makes a tick.<br><br>I could make several MenuItems and add some logic such selecting one checkbox deselects the others - but it isn't the right visual effect. It makes ticks and not dots.<br><br>I tried adding radio buttons to the Menu but the (o) selector is contained within the right hand content of the MenuItem and is not rendered in the margin.<br><br>Any ideas?<br>tia.<br>© 2009 Microsoft Corporation. All rights reserved.Thu, 30 Apr 2009 13:22:06 Z76c14163-9462-44d6-b0eb-6f22a006b423http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#76c14163-9462-44d6-b0eb-6f22a006b423http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#76c14163-9462-44d6-b0eb-6f22a006b423Wintercasehttp://social.msdn.microsoft.com/Profile/en-US/?user=WintercaseMenuItem as a radio / options listIs it possible to make a series of MenuItem's behave like a radio button list?<br>The effect that I want is the same as that in Windows Explorer under the View menu for List/Tiles/Details selection - a dot is placed against the selected item on the left hand margin and only one item may be selected at any one time.<br><br>I can set MenuItem.IsCheckable=true which will turn a MenuItem into a checkbox - that makes a tick.<br><br>I could make several MenuItems and add some logic such selecting one checkbox deselects the others - but it isn't the right visual effect. It makes ticks and not dots.<br><br>I tried adding radio buttons to the Menu but the (o) selector is contained within the right hand content of the MenuItem and is not rendered in the margin.<br><br>Any ideas?<br>tia.<br>Fri, 26 Oct 2007 21:22:07 Z2007-10-30T20:24:50Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#a4a1fa9f-86a6-4069-b7a9-09a25e9e14cbhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#a4a1fa9f-86a6-4069-b7a9-09a25e9e14cbBenny Topshttp://social.msdn.microsoft.com/Profile/en-US/?user=Benny%20TopsMenuItem as a radio / options listHi,<br><br>Is this you are looking for?<br><br>&lt;Menu xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br>        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&gt;<br>    &lt;MenuItem Header=&quot;RadioButtonMenuItem&quot;&gt;<br>         &lt;MenuItem&gt;<br>            &lt;MenuItem.Header&gt;<br>                &lt;StackPanel&gt;<br>                    &lt;RadioButton Content=&quot;Choice 1&quot;/&gt;<br>                    &lt;RadioButton Content=&quot;Choice 2&quot;/&gt;<br>                    &lt;RadioButton Content=&quot;Choice 3&quot;/&gt;<br>                &lt;/StackPanel&gt;<br>            &lt;/MenuItem.Header&gt;<br>        &lt;/MenuItem&gt;<br>  &lt;/MenuItem&gt;<br>&lt;/Menu&gt;<br><br>Best regards,<br><br>Benny<br>Fri, 26 Oct 2007 23:10:12 Z2007-10-26T23:10:12Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#f5ca5db7-3f09-416d-96e4-8bd59734c0f0http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#f5ca5db7-3f09-416d-96e4-8bd59734c0f0Wintercasehttp://social.msdn.microsoft.com/Profile/en-US/?user=WintercaseMenuItem as a radio / options listHey Benny - thanks for the reply - but its not quite what I am after. <br>If you paste my modified version below into XamlPad - notice how the tick of checkbox is rendered into the left hand margin of the menu item - where images are also placed if a menuItem has an image.<br><br>The radio button indicator really should also render itself into the left hand margin. <br>You can see the same effect in Windows Explorer -&gt; View menu.<br>The Details/Tile/Large indicator is rendered into the margin.<br>The Status Bar tick is also rendered into the margin<br><br><br>&lt;Menu xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br>        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;&gt;<br>    &lt;MenuItem Header=&quot;RadioButtonMenuItem&quot;&gt;<br>         &lt;MenuItem&gt;<br>            &lt;MenuItem.Header&gt;<br>                &lt;StackPanel&gt;<br>                    &lt;RadioButton Content=&quot;Choice 1&quot;/&gt;<br>                    &lt;RadioButton Content=&quot;Choice 2&quot;/&gt;<br>                    &lt;RadioButton Content=&quot;Choice 3&quot;/&gt;<br>                &lt;/StackPanel&gt;<br>            &lt;/MenuItem.Header&gt;<br>        &lt;/MenuItem&gt;<br>        &lt;MenuItem IsCheckable=&quot;True&quot; IsChecked=&quot;True&quot; Header=&quot;MyCheckbox&quot; /&gt;<br>        &lt;RadioButton Content=&quot;Choice A&quot;/&gt;<br><br><br>  &lt;/MenuItem&gt;<br>&lt;/Menu&gt;<br><br>Sat, 27 Oct 2007 04:42:10 Z2007-10-27T04:42:10Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#a7a49d47-e4a2-4752-9c92-50b3648604d4http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#a7a49d47-e4a2-4752-9c92-50b3648604d4Dr. WPFhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dr.%20WPFMenuItem as a radio / options list<p align=left><font face=Arial size=2></font> </p> <p>Look at the markup below in XamlPad and let me know if its more like what you're going for.  If you'd like, I can post some sample code demonstrating how to actually make the options interact like you'd expect from a menu.  Or you can probably come up with your own logic... it's really just a matter of setting the IsChecked property on the appropriate RadioButton in response to a MenuItem.Click event.  You can get at the radio button in code through the Icon property on the clicked MenuItem.  Simply cast it to a RadioButton.</p> <p align=left> </p><font color="#0000ff" size=2> <p align=left> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Block</span></div><font color="#0000ff" size=2> <p align=left> </p> <p align=left>&lt;</font><font color="#a31515" size=2>Page</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>xmlns</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>http://schemas.microsoft.com/winfx/2006/xaml/presentation</font><font size=2>&quot;</p></font><font color="#0000ff" size=2> <p align=left></font><font color="#ff0000" size=2>    xmlns:x</font><font color="#0000ff" size=2>=&quot;</font><font size=2></font><font color="#0000ff" size=2>http://schemas.microsoft.com/winfx/2006/xaml&quot;</font><font size=2></font><font color="#0000ff" size=2> &gt;</p> <p align=left>  &lt;</font><font color="#a31515" size=2>Grid</font><font color="#0000ff" size=2>&gt;</p> <p align=left>    &lt;</font><font color="#a31515" size=2>Menu</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>VerticalAlignment</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Top</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>      &lt;</font><font color="#a31515" size=2>Menu.Resources</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;</font><font color="#a31515" size=2>Style</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>x:Key</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Group1Style</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>TargetType</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>{x:Type RadioButton}</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>Setter</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Property</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>HorizontalAlignment</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Value</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>Center</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>Setter</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Property</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>GroupName</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Value</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>OptionGroup1</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>Setter</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Property</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>IsHitTestVisible</font><font size=2>&quot;</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Value</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>False</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p></font><font color="#0000ff" size=2> <p align=left>        &lt;/</font><font color="#a31515" size=2>Style</font><font color="#0000ff" size=2>&gt;</p> <p align=left>      &lt;/</font><font color="#a31515" size=2>Menu.Resources</font><font color="#0000ff" size=2>&gt;</p> <p align=left>      &lt;</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Header</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>_Options</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Header</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>_One</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>            &lt;</font><font color="#a31515" size=2>RadioButton</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Style</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>{StaticResource Group1Style}</font><font size=2>&quot;</font></p> <p align=left>            <font color="#0000ff" size=2>    <font color="#ff0000">IsChecked</font><font color="#0000ff" size=2>=</font><font color="#000000" size=2>&quot;<font color="#0000ff">True</font></font><font size=2>&quot; </font>/&gt;</p> <p align=left>          &lt;/</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;/</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Header</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>_Two</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>            &lt;</font><font color="#a31515" size=2>RadioButton</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Style</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>{StaticResource Group1Style}</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p> <p align=left>          &lt;/</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;/</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Header</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>T_hree</font><font size=2>&quot;</font><font color="#0000ff" size=2>&gt;</p> <p align=left>          &lt;</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>            &lt;</font><font color="#a31515" size=2>RadioButton</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>Style</font><font color="#0000ff" size=2>=</font><font size=2>&quot;</font><font color="#0000ff" size=2>{StaticResource Group1Style}</font><font size=2>&quot;</font><font color="#0000ff" size=2> /&gt;</p> <p align=left>          &lt;/</font><font color="#a31515" size=2>MenuItem.Icon</font><font color="#0000ff" size=2>&gt;</p> <p align=left>        &lt;/</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2>&gt;</p> <p align=left>      &lt;/</font><font color="#a31515" size=2>MenuItem</font><font color="#0000ff" size=2>&gt;</p> <p align=left>    &lt;/</font><font color="#a31515" size=2>Menu</font><font color="#0000ff" size=2>&gt;</p> <p align=left>  &lt;/</font><font color="#a31515" size=2>Grid</font><font color="#0000ff" size=2>&gt;</p> <p align=left>&lt;/</font><font color="#a31515" size=2>Page</font><font color="#0000ff" size=2>&gt;</p> <p align=left></font> </p></div></div> <p align=left> </p></font> <p></p><font color="#0000ff" size=2> <p align=left></font> </p>Sat, 27 Oct 2007 06:16:24 Z2007-10-27T10:54:47Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#d4c3eda2-0f62-47dc-8b43-c9e5ae1b912fhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#d4c3eda2-0f62-47dc-8b43-c9e5ae1b912fWintercasehttp://social.msdn.microsoft.com/Profile/en-US/?user=WintercaseMenuItem as a radio / options listha - nice trick Dr WPF - that will work nicely and I will figure the rest out from there <br>thanks!<br>Sat, 27 Oct 2007 10:54:33 Z2007-10-27T10:54:33Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#08eba7cf-4fae-4b9c-ae96-550b6c217ba9http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#08eba7cf-4fae-4b9c-ae96-550b6c217ba9Benny Topshttp://social.msdn.microsoft.com/Profile/en-US/?user=Benny%20TopsMenuItem as a radio / options listHi,<br><br>I have a sample right here, which does exactly what you want, I think. In the code-behind you see the code to toggle the MenuItems checked property. I also changed the ControlTemplate, so you have a bullet when a MenuItem is checked and you don't have the blue background when hovering over the items, exactly like it is in Explorer.<br><br> <div style="text-align:left"> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Block</span></div> <p>&lt;Window<br>    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;<br>    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;<br>    x:Class=&quot;MenuApp.Window1&quot;<br>    Title=&quot;MenuApp&quot; Height=&quot;300&quot; Width=&quot;300&quot;<br>    xmlns:Microsoft_Windows_Themes=&quot;clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna&quot;<br>    &gt;<br>  &lt;Window.Resources&gt;<br>    <br>      &lt;PathGeometry x:Key=&quot;Checkmark&quot; Figures=&quot;M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z&quot;/&gt;<br>      &lt;ControlTemplate x:Key=&quot;{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}&quot; TargetType=&quot;{x:Type MenuItem}&quot;&gt;<br>          &lt;Border SnapsToDevicePixels=&quot;true&quot; x:Name=&quot;Bd&quot; Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;<br>              &lt;Grid&gt;<br>                  &lt;Grid.ColumnDefinitions&gt;<br>                      &lt;ColumnDefinition MinWidth=&quot;17&quot; Width=&quot;Auto&quot; SharedSizeGroup=&quot;MenuItemIconColumnGroup&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;Auto&quot; SharedSizeGroup=&quot;MenuItemIGTColumnGroup&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;14&quot;/&gt;<br>                  &lt;/Grid.ColumnDefinitions&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;Icon&quot; VerticalAlignment=&quot;Center&quot; ContentSource=&quot;Icon&quot;/&gt;<br>                  &lt;Grid Visibility=&quot;Collapsed&quot; x:Name=&quot;grid&quot; Grid.ColumnSpan=&quot;1&quot;&gt;<br>                      &lt;Ellipse Fill=&quot;#FF000000&quot; Stroke=&quot;#FF000000&quot; Margin=&quot;6,6,6,6&quot; x:Name=&quot;ellipse&quot;/&gt;<br>                  &lt;/Grid&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;{TemplateBinding Padding}&quot; Grid.Column=&quot;1&quot; ContentSource=&quot;Header&quot; RecognizesAccessKey=&quot;True&quot;/&gt;<br>                  &lt;TextBlock Margin=&quot;5,2,0,2&quot; x:Name=&quot;InputGestureText&quot; Grid.Column=&quot;2&quot; DockPanel.Dock=&quot;Right&quot; Text=&quot;{TemplateBinding InputGestureText}&quot;/&gt;<br>              &lt;/Grid&gt;<br>          &lt;/Border&gt;<br>          &lt;ControlTemplate.Triggers&gt;<br>              &lt;Trigger Property=&quot;Icon&quot; Value=&quot;{x:Null}&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsChecked&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;grid&quot; Value=&quot;Visible&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsHighlighted&quot; Value=&quot;true&quot;/&gt;<br>              &lt;Trigger Property=&quot;IsEnabled&quot; Value=&quot;false&quot;&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>          &lt;/ControlTemplate.Triggers&gt;<br>      &lt;/ControlTemplate&gt;<br>      &lt;MenuScrollingVisibilityConverter x:Key=&quot;MenuScrollingVisibilityConverter&quot;/&gt;<br>      &lt;Style x:Key=&quot;MenuScrollButton&quot; BasedOn=&quot;{x:Null}&quot; TargetType=&quot;{x:Type RepeatButton}&quot;&gt;<br>          &lt;Setter Property=&quot;ClickMode&quot; Value=&quot;Hover&quot;/&gt;<br>          &lt;Setter Property=&quot;MinWidth&quot; Value=&quot;0&quot;/&gt;<br>          &lt;Setter Property=&quot;MinHeight&quot; Value=&quot;0&quot;/&gt;<br>          &lt;Setter Property=&quot;Template&quot;&gt;<br>              &lt;Setter.Value&gt;<br>                  &lt;ControlTemplate TargetType=&quot;{x:Type RepeatButton}&quot;&gt;<br>                      &lt;DockPanel SnapsToDevicePixels=&quot;true&quot; Background=&quot;Transparent&quot;&gt;<br>                          &lt;Rectangle Fill=&quot;Transparent&quot; x:Name=&quot;R1&quot; Width=&quot;1&quot; DockPanel.Dock=&quot;Right&quot;/&gt;<br>                          &lt;Rectangle Fill=&quot;Transparent&quot; x:Name=&quot;B1&quot; Height=&quot;1&quot; DockPanel.Dock=&quot;Bottom&quot;/&gt;<br>                          &lt;Rectangle Fill=&quot;Transparent&quot; x:Name=&quot;L1&quot; Width=&quot;1&quot; DockPanel.Dock=&quot;Left&quot;/&gt;<br>                          &lt;Rectangle Fill=&quot;Transparent&quot; x:Name=&quot;T1&quot; Height=&quot;1&quot; DockPanel.Dock=&quot;Top&quot;/&gt;<br>                          &lt;ContentPresenter HorizontalAlignment=&quot;Center&quot; Margin=&quot;2,2,2,2&quot; x:Name=&quot;ContentContainer&quot; VerticalAlignment=&quot;Center&quot;/&gt;<br>                      &lt;/DockPanel&gt;<br>                      &lt;ControlTemplate.Triggers&gt;<br>                          &lt;Trigger Property=&quot;IsPressed&quot; Value=&quot;true&quot;&gt;<br>                              &lt;Setter Property=&quot;Fill&quot; TargetName=&quot;R1&quot; Value=&quot;{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}&quot;/&gt;<br>                              &lt;Setter Property=&quot;Fill&quot; TargetName=&quot;B1&quot; Value=&quot;{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}&quot;/&gt;<br>                              &lt;Setter Property=&quot;Fill&quot; TargetName=&quot;L1&quot; Value=&quot;{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}&quot;/&gt;<br>                              &lt;Setter Property=&quot;Fill&quot; TargetName=&quot;T1&quot; Value=&quot;{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}&quot;/&gt;<br>                              &lt;Setter Property=&quot;Margin&quot; TargetName=&quot;ContentContainer&quot; Value=&quot;3,3,1,1&quot;/&gt;<br>                          &lt;/Trigger&gt;<br>                      &lt;/ControlTemplate.Triggers&gt;<br>                  &lt;/ControlTemplate&gt;<br>              &lt;/Setter.Value&gt;<br>          &lt;/Setter&gt;<br>      &lt;/Style&gt;<br>      &lt;Geometry x:Key=&quot;UpArrow&quot;&gt;M 0,4 L 3.5,0 L 7,4 Z&lt;/Geometry&gt;<br>      &lt;Geometry x:Key=&quot;DownArrow&quot;&gt;M 0,0 L 3.5,4 L 7,0 Z&lt;/Geometry&gt;<br>      &lt;Style x:Key=&quot;{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}&quot; BasedOn=&quot;{x:Null}&quot; TargetType=&quot;{x:Type ScrollViewer}&quot;&gt;<br>          &lt;Setter Property=&quot;HorizontalScrollBarVisibility&quot; Value=&quot;Hidden&quot;/&gt;<br>          &lt;Setter Property=&quot;VerticalScrollBarVisibility&quot; Value=&quot;Auto&quot;/&gt;<br>          &lt;Setter Property=&quot;Template&quot;&gt;<br>              &lt;Setter.Value&gt;<br>                  &lt;ControlTemplate TargetType=&quot;{x:Type ScrollViewer}&quot;&gt;<br>                      &lt;Grid SnapsToDevicePixels=&quot;true&quot;&gt;<br>                          &lt;Grid.ColumnDefinitions&gt;<br>                              &lt;ColumnDefinition Width=&quot;*&quot;/&gt;<br>                          &lt;/Grid.ColumnDefinitions&gt;<br>                          &lt;Grid.RowDefinitions&gt;<br>                              &lt;RowDefinition Height=&quot;Auto&quot;/&gt;<br>                              &lt;RowDefinition Height=&quot;*&quot;/&gt;<br>                              &lt;RowDefinition Height=&quot;Auto&quot;/&gt;<br>                          &lt;/Grid.RowDefinitions&gt;<br>                          &lt;Border Grid.Column=&quot;0&quot; Grid.Row=&quot;1&quot;&gt;<br>                              &lt;ScrollContentPresenter Margin=&quot;{TemplateBinding Padding}&quot;/&gt;<br>                          &lt;/Border&gt;<br>                          &lt;RepeatButton Focusable=&quot;false&quot; Style=&quot;{StaticResource MenuScrollButton}&quot; Grid.Column=&quot;0&quot; Grid.Row=&quot;0&quot; Command=&quot;{x:Static ScrollBar.LineUpCommand}&quot; CommandTarget=&quot;{Binding RelativeSource={RelativeSource TemplatedParent}}&quot;&gt;<br>                              &lt;RepeatButton.Visibility&gt;<br>                                  &lt;MultiBinding FallbackValue=&quot;Visibility.Collapsed&quot; Converter=&quot;{StaticResource MenuScrollingVisibilityConverter}&quot; ConverterParameter=&quot;0&quot;&gt;<br>                                      &lt;Binding Path=&quot;ComputedVerticalScrollBarVisibility&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;VerticalOffset&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;ExtentHeight&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;ViewportHeight&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                  &lt;/MultiBinding&gt;<br>                              &lt;/RepeatButton.Visibility&gt;<br>                              &lt;Path Fill=&quot;{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}&quot; Data=&quot;{StaticResource UpArrow}&quot;/&gt;<br>                          &lt;/RepeatButton&gt;<br>                          &lt;RepeatButton Focusable=&quot;false&quot; Style=&quot;{StaticResource MenuScrollButton}&quot; Grid.Column=&quot;0&quot; Grid.Row=&quot;2&quot; Command=&quot;{x:Static ScrollBar.LineDownCommand}&quot; CommandTarget=&quot;{Binding RelativeSource={RelativeSource TemplatedParent}}&quot;&gt;<br>                              &lt;RepeatButton.Visibility&gt;<br>                                  &lt;MultiBinding FallbackValue=&quot;Visibility.Collapsed&quot; Converter=&quot;{StaticResource MenuScrollingVisibilityConverter}&quot; ConverterParameter=&quot;100&quot;&gt;<br>                                      &lt;Binding Path=&quot;ComputedVerticalScrollBarVisibility&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;VerticalOffset&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;ExtentHeight&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                      &lt;Binding Path=&quot;ViewportHeight&quot; RelativeSource=&quot;{RelativeSource TemplatedParent}&quot;/&gt;<br>                                  &lt;/MultiBinding&gt;<br>                              &lt;/RepeatButton.Visibility&gt;<br>                              &lt;Path Fill=&quot;{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}&quot; Data=&quot;{StaticResource DownArrow}&quot;/&gt;<br>                          &lt;/RepeatButton&gt;<br>                      &lt;/Grid&gt;<br>                  &lt;/ControlTemplate&gt;<br>              &lt;/Setter.Value&gt;<br>          &lt;/Setter&gt;<br>      &lt;/Style&gt;<br>      &lt;ControlTemplate x:Key=&quot;{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}&quot; TargetType=&quot;{x:Type MenuItem}&quot;&gt;<br>          &lt;Border SnapsToDevicePixels=&quot;true&quot; x:Name=&quot;Bd&quot; Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;<br>              &lt;DockPanel&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;Icon&quot; VerticalAlignment=&quot;Center&quot; ContentSource=&quot;Icon&quot;/&gt;<br>                  &lt;Path Visibility=&quot;Collapsed&quot; Fill=&quot;{TemplateBinding Foreground}&quot; FlowDirection=&quot;LeftToRight&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;GlyphPanel&quot; VerticalAlignment=&quot;Center&quot; Data=&quot;{StaticResource Checkmark}&quot;/&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;{TemplateBinding Padding}&quot; ContentSource=&quot;Header&quot; RecognizesAccessKey=&quot;True&quot;/&gt;<br>                  &lt;Popup Focusable=&quot;false&quot; AllowsTransparency=&quot;true&quot; IsOpen=&quot;{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}&quot; Placement=&quot;Bottom&quot; PopupAnimation=&quot;{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}&quot; x:Name=&quot;PART_Popup&quot;&gt;<br>                      &lt;Microsoft_Windows_Themes:SystemDropShadowChrome x:Name=&quot;Shdw&quot; Color=&quot;Transparent&quot;&gt;<br>                          &lt;Border x:Name=&quot;SubMenuBorder&quot; Background=&quot;{DynamicResource {x:Static SystemColors.MenuBrushKey}}&quot; BorderBrush=&quot;{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}&quot; BorderThickness=&quot;1&quot;&gt;<br>                              &lt;ScrollViewer Style=&quot;{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}&quot; CanContentScroll=&quot;true&quot;&gt;<br>                                  &lt;ItemsPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;2&quot; Grid.IsSharedSizeScope=&quot;true&quot; KeyboardNavigation.DirectionalNavigation=&quot;Cycle&quot; KeyboardNavigation.TabNavigation=&quot;Cycle&quot;/&gt;<br>                              &lt;/ScrollViewer&gt;<br>                          &lt;/Border&gt;<br>                      &lt;/Microsoft_Windows_Themes:SystemDropShadowChrome&gt;<br>                  &lt;/Popup&gt;<br>              &lt;/DockPanel&gt;<br>          &lt;/Border&gt;<br>          &lt;ControlTemplate.Triggers&gt;<br>              &lt;Trigger Property=&quot;IsSuspendingPopupAnimation&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;PopupAnimation&quot; TargetName=&quot;PART_Popup&quot; Value=&quot;None&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;Icon&quot; Value=&quot;{x:Null}&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsChecked&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;GlyphPanel&quot; Value=&quot;Visible&quot;/&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsHighlighted&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Background&quot; TargetName=&quot;Bd&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightBrushKey}}&quot;/&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsEnabled&quot; Value=&quot;false&quot;&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;HasDropShadow&quot; SourceName=&quot;PART_Popup&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Margin&quot; TargetName=&quot;Shdw&quot; Value=&quot;0,0,5,5&quot;/&gt;<br>                  &lt;Setter Property=&quot;Color&quot; TargetName=&quot;Shdw&quot; Value=&quot;#71000000&quot;/&gt;<br>              &lt;/Trigger&gt;<br>          &lt;/ControlTemplate.Triggers&gt;<br>      &lt;/ControlTemplate&gt;<br>      &lt;ControlTemplate x:Key=&quot;{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}&quot; TargetType=&quot;{x:Type MenuItem}&quot;&gt;<br>          &lt;Border SnapsToDevicePixels=&quot;true&quot; x:Name=&quot;Bd&quot; Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;<br>              &lt;DockPanel&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;Icon&quot; VerticalAlignment=&quot;Center&quot; ContentSource=&quot;Icon&quot;/&gt;<br>                  &lt;Path Visibility=&quot;Collapsed&quot; Fill=&quot;{TemplateBinding Foreground}&quot; FlowDirection=&quot;LeftToRight&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;GlyphPanel&quot; VerticalAlignment=&quot;Center&quot; Data=&quot;{StaticResource Checkmark}&quot;/&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;{TemplateBinding Padding}&quot; ContentSource=&quot;Header&quot; RecognizesAccessKey=&quot;True&quot;/&gt;<br>              &lt;/DockPanel&gt;<br>          &lt;/Border&gt;<br>          &lt;ControlTemplate.Triggers&gt;<br>              &lt;Trigger Property=&quot;Icon&quot; Value=&quot;{x:Null}&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsChecked&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;GlyphPanel&quot; Value=&quot;Visible&quot;/&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsHighlighted&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Background&quot; TargetName=&quot;Bd&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightBrushKey}}&quot;/&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsEnabled&quot; Value=&quot;false&quot;&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>          &lt;/ControlTemplate.Triggers&gt;<br>      &lt;/ControlTemplate&gt;<br>      &lt;Geometry x:Key=&quot;RightArrow&quot;&gt;M 0,0 L 4,3.5 L 0,7 Z&lt;/Geometry&gt;<br>      &lt;ControlTemplate x:Key=&quot;{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}&quot; TargetType=&quot;{x:Type MenuItem}&quot;&gt;<br>          &lt;Border SnapsToDevicePixels=&quot;true&quot; x:Name=&quot;Bd&quot; Background=&quot;{TemplateBinding Background}&quot; BorderBrush=&quot;{TemplateBinding BorderBrush}&quot; BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;<br>              &lt;Grid&gt;<br>                  &lt;Grid.ColumnDefinitions&gt;<br>                      &lt;ColumnDefinition MinWidth=&quot;17&quot; Width=&quot;Auto&quot; SharedSizeGroup=&quot;MenuItemIconColumnGroup&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;*&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;Auto&quot; SharedSizeGroup=&quot;MenuItemIGTColumnGroup&quot;/&gt;<br>                      &lt;ColumnDefinition Width=&quot;14&quot;/&gt;<br>                  &lt;/Grid.ColumnDefinitions&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;Icon&quot; VerticalAlignment=&quot;Center&quot; ContentSource=&quot;Icon&quot;/&gt;<br>                  &lt;Path Visibility=&quot;Hidden&quot; Fill=&quot;{TemplateBinding Foreground}&quot; FlowDirection=&quot;LeftToRight&quot; Margin=&quot;4,0,6,0&quot; x:Name=&quot;GlyphPanel&quot; VerticalAlignment=&quot;Center&quot; Data=&quot;{StaticResource Checkmark}&quot;/&gt;<br>                  &lt;ContentPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;{TemplateBinding Padding}&quot; Grid.Column=&quot;1&quot; ContentSource=&quot;Header&quot; RecognizesAccessKey=&quot;True&quot;/&gt;<br>                  &lt;Path Fill=&quot;{TemplateBinding Foreground}&quot; Margin=&quot;4,0,6,0&quot; VerticalAlignment=&quot;Center&quot; Grid.Column=&quot;3&quot; DockPanel.Dock=&quot;Right&quot; Data=&quot;{StaticResource RightArrow}&quot;/&gt;<br>                  &lt;Popup Focusable=&quot;false&quot; AllowsTransparency=&quot;true&quot; IsOpen=&quot;{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}&quot; Placement=&quot;Right&quot; PopupAnimation=&quot;{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}&quot; VerticalOffset=&quot;-3&quot; x:Name=&quot;PART_Popup&quot;&gt;<br>                      &lt;Microsoft_Windows_Themes:SystemDropShadowChrome x:Name=&quot;Shdw&quot; Color=&quot;Transparent&quot;&gt;<br>                          &lt;Border x:Name=&quot;SubMenuBorder&quot; Background=&quot;{DynamicResource {x:Static SystemColors.MenuBrushKey}}&quot; BorderBrush=&quot;{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}&quot; BorderThickness=&quot;1&quot;&gt;<br>                              &lt;ScrollViewer Style=&quot;{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}&quot; CanContentScroll=&quot;true&quot;&gt;<br>                                  &lt;ItemsPresenter SnapsToDevicePixels=&quot;{TemplateBinding SnapsToDevicePixels}&quot; Margin=&quot;2&quot; Grid.IsSharedSizeScope=&quot;true&quot; KeyboardNavigation.DirectionalNavigation=&quot;Cycle&quot; KeyboardNavigation.TabNavigation=&quot;Cycle&quot;/&gt;<br>                              &lt;/ScrollViewer&gt;<br>                          &lt;/Border&gt;<br>                      &lt;/Microsoft_Windows_Themes:SystemDropShadowChrome&gt;<br>                  &lt;/Popup&gt;<br>              &lt;/Grid&gt;<br>          &lt;/Border&gt;<br>          &lt;ControlTemplate.Triggers&gt;<br>              &lt;Trigger Property=&quot;IsSuspendingPopupAnimation&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;PopupAnimation&quot; TargetName=&quot;PART_Popup&quot; Value=&quot;None&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;Icon&quot; Value=&quot;{x:Null}&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsChecked&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;GlyphPanel&quot; Value=&quot;Visible&quot;/&gt;<br>                  &lt;Setter Property=&quot;Visibility&quot; TargetName=&quot;Icon&quot; Value=&quot;Collapsed&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;HasDropShadow&quot; SourceName=&quot;PART_Popup&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Margin&quot; TargetName=&quot;Shdw&quot; Value=&quot;0,0,5,5&quot;/&gt;<br>                  &lt;Setter Property=&quot;Color&quot; TargetName=&quot;Shdw&quot; Value=&quot;#71000000&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsHighlighted&quot; Value=&quot;true&quot;&gt;<br>                  &lt;Setter Property=&quot;Background&quot; TargetName=&quot;Bd&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightBrushKey}}&quot;/&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;IsEnabled&quot; Value=&quot;false&quot;&gt;<br>                  &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>          &lt;/ControlTemplate.Triggers&gt;<br>      &lt;/ControlTemplate&gt;<br>      &lt;Style x:Key=&quot;MenuItemStyle1&quot; TargetType=&quot;{x:Type MenuItem}&quot;&gt;<br>          &lt;Setter Property=&quot;HorizontalContentAlignment&quot; Value=&quot;{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}&quot;/&gt;<br>          &lt;Setter Property=&quot;VerticalContentAlignment&quot; Value=&quot;{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}&quot;/&gt;<br>          &lt;Setter Property=&quot;Background&quot; Value=&quot;Transparent&quot;/&gt;<br>          &lt;Setter Property=&quot;Foreground&quot; Value=&quot;{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}&quot;/&gt;<br>          &lt;Setter Property=&quot;Template&quot; Value=&quot;{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}&quot;/&gt;<br>          &lt;Style.Triggers&gt;<br>              &lt;Trigger Property=&quot;Role&quot; Value=&quot;TopLevelHeader&quot;&gt;<br>                  &lt;Setter Property=&quot;Margin&quot; Value=&quot;0,1,0,1&quot;/&gt;<br>                  &lt;Setter Property=&quot;Padding&quot; Value=&quot;6,3,6,3&quot;/&gt;<br>                  &lt;Setter Property=&quot;Template&quot; Value=&quot;{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;Role&quot; Value=&quot;TopLevelItem&quot;&gt;<br>                  &lt;Setter Property=&quot;Margin&quot; Value=&quot;0,1,0,1&quot;/&gt;<br>                  &lt;Setter Property=&quot;Padding&quot; Value=&quot;6,3,6,3&quot;/&gt;<br>                  &lt;Setter Property=&quot;Template&quot; Value=&quot;{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;Role&quot; Value=&quot;SubmenuHeader&quot;&gt;<br>                  &lt;Setter Property=&quot;DockPanel.Dock&quot; Value=&quot;Top&quot;/&gt;<br>                  &lt;Setter Property=&quot;Padding&quot; Value=&quot;0,2,0,2&quot;/&gt;<br>                  &lt;Setter Property=&quot;Template&quot; Value=&quot;{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}&quot;/&gt;<br>              &lt;/Trigger&gt;<br>              &lt;Trigger Property=&quot;Role&quot; Value=&quot;SubmenuItem&quot;&gt;<br>                  &lt;Setter Property=&quot;DockPanel.Dock&quot; Value=&quot;Top&quot;/&gt;<br>                  &lt;Setter Property=&quot;Padding&quot; Value=&quot;0,2,0,2&quot;/&gt;<br>              &lt;/Trigger&gt;<br>          &lt;/Style.Triggers&gt;<br>      &lt;/Style&gt;<br>    <br>  &lt;/Window.Resources&gt;<br>  &lt;Grid&gt;<br>    &lt;Menu VerticalAlignment=&quot;Top&quot;&gt;<br>      &lt;MenuItem Header=&quot;Background&quot;&gt;<br>        &lt;MenuItem Header=&quot;Blue&quot; Tag=&quot;Blue&quot; Click=&quot;BackgroundOnClick&quot; Style=&quot;{DynamicResource MenuItemStyle1}&quot;/&gt;<br>        &lt;MenuItem Header=&quot;Green&quot; Tag=&quot;Green&quot; Click=&quot;BackgroundOnClick&quot;/&gt;<br>        &lt;MenuItem Header=&quot;Red&quot; Tag=&quot;Red&quot; Click=&quot;BackgroundOnClick&quot;/&gt;<br>        &lt;MenuItem Header=&quot;Yellow&quot; Tag=&quot;Yellow&quot; Click=&quot;BackgroundOnClick&quot;/&gt;<br>      &lt;/MenuItem&gt;<br>    &lt;/Menu&gt;<br>  &lt;/Grid&gt;<br>&lt;/Window&gt;<br><br>using System;<br>using System.Collections.Generic;<br>using System.Text;<br>using System.Windows;<br>using System.Windows.Controls;<br>using System.Windows.Data;<br>using System.Windows.Documents;<br>using System.Windows.Input;<br>using System.Windows.Media;<br>using System.Windows.Media.Imaging;<br>using System.Windows.Shapes;<br><br><br>namespace MenuApp<br>{<br>    /// &lt;summary&gt;<br>    /// Interaction logic for Window1.xaml<br>    /// &lt;/summary&gt;<br><br>    public partial class Window1 : System.Windows.Window<br>    {<br>        MenuItem itemChecked;<br><br>        public Window1()<br>        {<br>            InitializeComponent();<br>        }<br><br>        void BackgroundOnClick(object sender, RoutedEventArgs args)<br>        {<br>            if (itemChecked!=null)<br>                itemChecked.IsChecked = false;<br>            itemChecked = args.Source as MenuItem;<br>            itemChecked.IsChecked = true;<br>            BrushConverter converter = new BrushConverter();<br>            Background = (Brush)converter.ConvertFromString(itemChecked.Tag.ToString());<br>        }<br>    }<br>}</p></div></div><br></div><br>Best  regards,<br><br>Benny<br>Sat, 27 Oct 2007 11:29:03 Z2007-10-30T20:24:50Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#d03dc34b-44cf-4599-aad0-8ddead62b482http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#d03dc34b-44cf-4599-aad0-8ddead62b482Wintercasehttp://social.msdn.microsoft.com/Profile/en-US/?user=WintercaseMenuItem as a radio / options listwow Benny - thats awesome. thanks!<br>Tue, 30 Oct 2007 20:24:35 Z2007-10-30T20:24:35Zhttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#566dcd90-b6ab-4a22-a202-b4c2cb43361ahttp://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76c14163-9462-44d6-b0eb-6f22a006b423#566dcd90-b6ab-4a22-a202-b4c2cb43361aEchilonhttp://social.msdn.microsoft.com/Profile/en-US/?user=EchilonMenuItem as a radio / options listThat's a really useful snippet. Thanks.Thu, 30 Apr 2009 13:13:59 Z2009-04-30T13:13:59Z