Advertisement
PelicanDevelopment

MenuItem

Jan 6th, 2021
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. <Style x:Key="CustomMenuI" TargetType="{x:Type MenuItem}">
  2. <Setter Property="Template">
  3. <Setter.Value>
  4. <ControlTemplate TargetType="{x:Type MenuItem}">
  5. <Border x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  6. <Grid VerticalAlignment="Center">
  7. <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center"/>
  8. <Popup x:Name="PART_Popup" AllowsTransparency="True" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
  9. <Border Width="95" x:Name="SubMenuBorder" BorderBrush="#353535" BorderThickness="1" Background="#262626" Padding="0">
  10. <ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  11. <Grid RenderOptions.ClearTypeHint="Enabled">
  12. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
  13. </Grid>
  14. </ScrollViewer>
  15. </Border>
  16. </Popup>
  17. </Grid>
  18. </Border>
  19. <ControlTemplate.Triggers>
  20. <Trigger Property="IsSuspendingPopupAnimation" Value="True">
  21. <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
  22. </Trigger>
  23. <Trigger Property="IsHighlighted" Value="True">
  24. <!--This is for the colour on hover-->
  25. <Setter Property="Background" TargetName="templateRoot" Value="#232323"/>
  26. <Setter Property="BorderBrush" TargetName="templateRoot" Value="#282828"/>
  27. </Trigger>
  28. <Trigger Property="IsEnabled" Value="False">
  29. <Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="#FF707070"/>
  30. </Trigger>
  31. </ControlTemplate.Triggers>
  32. </ControlTemplate>
  33. </Setter.Value>
  34. </Setter>
  35. </Style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement