Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //in app.xaml
- //...
- <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
- <Border Name="Border" >
- <Grid>
- <ContentPresenter
- Margin="6,3,6,3"
- ContentSource="Header"
- RecognizesAccessKey="True" />
- <Popup
- Name="Popup"
- Placement="Bottom"
- IsOpen="{TemplateBinding IsSubmenuOpen}"
- AllowsTransparency="True"
- Focusable="False"
- PopupAnimation="Fade">
- <Border
- Name="SubmenuBorder"
- SnapsToDevicePixels="True"
- Background= "#0D000000" >
- <StackPanel
- IsItemsHost="True"
- KeyboardNavigation.DirectionalNavigation="Cycle" />
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSuspendingPopupAnimation" Value="true">
- <Setter TargetName="Popup" Property="PopupAnimation" Value="None"/>
- </Trigger>
- <Trigger Property="IsHighlighted" Value="true">
- <Setter TargetName="Border" Property="Background" Value="#C0C0C0"/>
- <Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
- </Trigger>
- <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
- <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/>
- <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="#888888"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
- <Border Name="Border" >
- <Grid>
- <ContentPresenter
- Margin="6,3,6,3"
- ContentSource="Header"
- RecognizesAccessKey="True" />
- <Popup
- Name="Popup"
- Placement="Right"
- IsOpen="{TemplateBinding IsSubmenuOpen}"
- AllowsTransparency="True"
- Focusable="False"
- PopupAnimation="Fade">
- <Border
- Name="SubmenuBorder"
- SnapsToDevicePixels="True"
- Background="#0D000000">
- <StackPanel
- IsItemsHost="True"
- KeyboardNavigation.DirectionalNavigation="Cycle" />
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSuspendingPopupAnimation" Value="true">
- <Setter TargetName="Popup" Property="PopupAnimation" Value="None"/>
- </Trigger>
- <Trigger Property="IsHighlighted" Value="true">
- <Setter TargetName="Border" Property="Background" Value="#C0C0C0"/>
- <Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
- </Trigger>
- <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
- <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/>
- <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Foreground" Value="#888888"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
Add Comment
Please, Sign In to add comment