Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Sub Menu Items Not Showing

$
0
0

Hi,

I am having some problems with my sub MenuItem's not showing. I have the Header showing for each MenuItem that is nested within a Menu. But when I nest MenuItem within a MenuItem tag , the sub MenuItem's don't show. ]

I am working with my own ControlTemplate.

Here is the XAML for my Menu Style:

<!--Top Level Menu--><Style x:Key="TopLevelMenu" TargetType="{x:Type Menu}"><!--Menu Setters--><Setter Property="Width" Value="Auto"/><Setter Property="Height" Value="16"/><!--Setting Menu Template--><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Menu}"><!--Menu Template--><Border x:Name="MenuBorder"
                            BorderThickness="0"
                            Background="Transparent"><!--Content Placement--><ItemPresenter x:Name="MenuPresenter"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center"/></Border></ControlTemplate></Setter.Value></Setter></Style>

And here is the XAML for my MenuItem Style:

<!--Top Level Menu Items--><Style x:Key="TopLevelMenuItem" TargetType="{x:Type MenuItem}"><!--Menu Item Setters--><Setter Property="FontFamily" Value="Segeo UI Light"/><Setter Property="FontSize" Value="12"/><Setter Property="Foreground" Value="{StaticResource S2ENGINEHD.Text}"/><Setter Property="Padding" Value="2"/><Setter Property="Width" Value="Auto"/><Setter Property="Height" Value="16"/><!--Setting Menu Item Template--><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type MenuItem}"><!--Menu Item Template--><Border x:Name="MenuItemBorder"
                            BorderThickness="0"
                            Background="{StaticResource S2ENGINEHD.DarkBackground}"><!--Content Resizer--><Viewbox><!--Content Placement--><Content x:Name="MenuItemPresenter"
                                             HorizontalAlignment="Left"
                                             VerticalAlignment="Center"
                                             ContentTemplate="{TemplateBinding HeaderTemplate}"
                                             Content="{TemplateBinding Header}"
                                             ContentStringFormat="{TemplateBinding HeaderStringFormat}"
                                             ContentSource="{TemplateBinding HeaderStringFormat}"
                                             Margin="{TemplateBinding Padding}"
                                             RecognizesAccessKey="True"
                                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                             ToolTip="{TemplateBinding ToolTip}"/></Viewbox></Border><ControlTemplate.Triggers><!--On MouseOver Condition--><Trigger Property="IsMouseOver" Value="True"><!--Set Button Background On MouseOver--><Setter Property="Background" TargetName="MenuItemBorder" Value="{StaticResource S2ENGINEHD.Hover}"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style>

I'm not to sure if I am missing something in one of my Styles. The Header for the MenuItem is showing but anything nested within the MenuItem doesn't show.

Here is the usage:

<!--Top Level Menu--><Grid x:Name="TopLevelMenu" Width="Auto" Height="16" VerticalAlignment="Bottom" Background="{StaticResource S2ENGINE.GradientBackground}" Grid.Row="2"><!--Menu--><Menu Style="{StaticResource TopLevelMenu}"><!--Menu Items--><MenuItem Style="{StaticResource TopLevelMenuItem}" Header="File"><MenuItem Style="{StaticResource TopLevelMenuItem}" Header="New"/><MenuItem Style="{StaticResource TopLevelMenuItem}" Header="Open"/><MenuItem Style="{StaticResource TopLevelMenuItem}" Header="Save"/><MenuItem/><MenuItem Style="{StaticResource TopLevelMenuItem}" Header="Edit"/><MenuItem Style="{StaticResource TopLevelMenuItem}"Header="Tools"/><MenuItem Style="{StaticResource TopLevelMenuItem}"Header="Game"/><MenuItem Style="{StaticResource TopLevelMenuItem}"Header="Render"/><MenuItem Style="{StaticResource TopLevelMenuItem}"Header="Help"/></Menu></Grid>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>