KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If I add a submenu to a menu item, then the submenu is not being styled properly. One can only style the menuitem at this point, and not the actual sub menu. Hence one can't replace the IsMouseOver styling which then just defaults to whatever theme is enabled on windows. How can one style the submenu? <Style TargetType="{x:Type MenuItem}"> <Setter Property="Background" Value="#0f3c5a"></Setter> <Setter Property="Foreground" Value="White"></Setter> <Style.Triggers> <Trigger Property="IsHighlighted" Value="True"> <Setter Property="Background" Value="Black"></Setter> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="LightGray"></Setter> </Trigger> </Style.Triggers> </Style> <Style TargetType="{x:Type ContextMenu}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContextMenu}"> <!--Here is where you change the border thickness to zero on the menu--> <Border BorderThickness="0" x:Name="Border" > <StackPanel ClipToBounds="True" Orientation="Vertical" IsItemsHost="True"/> </Border> <ControlTemplate.Triggers>
Tags (comma-separated)
Save Edits
Cancel