ionut258

menuitem_transparent

Feb 10th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.96 KB | None | 0 0
  1. //in app.xaml
  2. //...
  3. <ControlTemplate x:Key="{x:Static MenuItem.TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
  4.             <Border Name="Border" >
  5.                 <Grid>
  6.                     <ContentPresenter
  7.        Margin="6,3,6,3"
  8.        ContentSource="Header"                            
  9.        RecognizesAccessKey="True" />
  10.                     <Popup
  11.      Name="Popup"
  12.      Placement="Bottom"
  13.      IsOpen="{TemplateBinding IsSubmenuOpen}"
  14.      AllowsTransparency="True"
  15.      Focusable="False"                          
  16.      PopupAnimation="Fade">
  17.                         <Border
  18.        Name="SubmenuBorder"
  19.        SnapsToDevicePixels="True"
  20.  
  21.         Background= "#0D000000"   >
  22.                             <StackPanel  
  23.          IsItemsHost="True"
  24.          KeyboardNavigation.DirectionalNavigation="Cycle" />
  25.                         </Border>
  26.                     </Popup>
  27.                 </Grid>
  28.             </Border>
  29.             <ControlTemplate.Triggers>
  30.                 <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  31.                     <Setter TargetName="Popup" Property="PopupAnimation" Value="None"/>
  32.                 </Trigger>
  33.                 <Trigger Property="IsHighlighted" Value="true">
  34.                     <Setter TargetName="Border" Property="Background" Value="#C0C0C0"/>
  35.                     <Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
  36.                 </Trigger>
  37.                 <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
  38.                     <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/>
  39.                     <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/>
  40.                 </Trigger>
  41.                 <Trigger Property="IsEnabled" Value="False">
  42.                     <Setter Property="Foreground" Value="#888888"/>
  43.                 </Trigger>
  44.             </ControlTemplate.Triggers>
  45.         </ControlTemplate>
  46.  
  47.         <ControlTemplate x:Key="{x:Static MenuItem.SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
  48.             <Border Name="Border" >
  49.                 <Grid>
  50.                     <ContentPresenter
  51.        Margin="6,3,6,3"
  52.        ContentSource="Header"                            
  53.        RecognizesAccessKey="True" />
  54.                     <Popup
  55.      Name="Popup"
  56.      Placement="Right"
  57.      IsOpen="{TemplateBinding IsSubmenuOpen}"
  58.      AllowsTransparency="True"
  59.      Focusable="False"                          
  60.      PopupAnimation="Fade">
  61.                         <Border
  62.        Name="SubmenuBorder"
  63.        SnapsToDevicePixels="True"
  64.        Background="#0D000000">
  65.                             <StackPanel  
  66.          IsItemsHost="True"
  67.          KeyboardNavigation.DirectionalNavigation="Cycle" />
  68.                         </Border>
  69.                     </Popup>
  70.                 </Grid>
  71.             </Border>
  72.             <ControlTemplate.Triggers>
  73.                 <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  74.                     <Setter TargetName="Popup" Property="PopupAnimation" Value="None"/>
  75.                 </Trigger>
  76.                 <Trigger Property="IsHighlighted" Value="true">
  77.                     <Setter TargetName="Border" Property="Background" Value="#C0C0C0"/>
  78.                     <Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
  79.                 </Trigger>
  80.                 <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
  81.                     <Setter TargetName="SubmenuBorder" Property="CornerRadius" Value="0,0,4,4"/>
  82.                     <Setter TargetName="SubmenuBorder" Property="Padding" Value="0,0,0,3"/>
  83.                 </Trigger>
  84.                 <Trigger Property="IsEnabled" Value="False">
  85.                     <Setter Property="Foreground" Value="#888888"/>
  86.                 </Trigger>
  87.             </ControlTemplate.Triggers>
  88.  
  89.  
  90.  
  91.         </ControlTemplate>
Add Comment
Please, Sign In to add comment