MenuItem.xaml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d">
  7. <Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
  8. <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
  9. <Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
  10. <Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
  11. <Setter Property="ClickMode" Value="Hover"/>
  12. <Setter Property="MinWidth" Value="0"/>
  13. <Setter Property="MinHeight" Value="0"/>
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate TargetType="{x:Type RepeatButton}">
  17. <DockPanel SnapsToDevicePixels="true" Background="Transparent">
  18. <Rectangle x:Name="R1" Fill="Transparent" Width="1" DockPanel.Dock="Right"/>
  19. <Rectangle x:Name="B1" Fill="Transparent" Height="1" DockPanel.Dock="Bottom"/>
  20. <Rectangle x:Name="L1" Fill="Transparent" Width="1" DockPanel.Dock="Left"/>
  21. <Rectangle x:Name="T1" Fill="Transparent" Height="1" DockPanel.Dock="Top"/>
  22. <ContentPresenter x:Name="ContentContainer" HorizontalAlignment="Center" Margin="2,2,2,2" VerticalAlignment="Center"/>
  23. </DockPanel>
  24. <ControlTemplate.Triggers>
  25. <Trigger Property="IsPressed" Value="true">
  26. <Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
  27. <Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
  28. <Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
  29. <Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
  30. <Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
  31. </Trigger>
  32. </ControlTemplate.Triggers>
  33. </ControlTemplate>
  34. </Setter.Value>
  35. </Setter>
  36. </Style>
  37. <Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
  38. <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
  39. <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
  40. <Setter Property="Template">
  41. <Setter.Value>
  42. <ControlTemplate TargetType="{x:Type ScrollViewer}">
  43. <Grid SnapsToDevicePixels="true">
  44. <Grid.ColumnDefinitions>
  45. <ColumnDefinition Width="*"/>
  46. </Grid.ColumnDefinitions>
  47. <Grid.RowDefinitions>
  48. <RowDefinition Height="Auto"/>
  49. <RowDefinition Height="*"/>
  50. <RowDefinition Height="Auto"/>
  51. </Grid.RowDefinitions>
  52. <Border Grid.Column="0" Grid.Row="1">
  53. <ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
  54. </Border>
  55. <RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="0" Grid.Row="0">
  56. <RepeatButton.Visibility>
  57. <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
  58. <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
  59. <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
  60. <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
  61. <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
  62. </MultiBinding>
  63. </RepeatButton.Visibility>
  64. <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource UpArrow}"/>
  65. </RepeatButton>
  66. <RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="0" Grid.Row="2">
  67. <RepeatButton.Visibility>
  68. <MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
  69. <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
  70. <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
  71. <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
  72. <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
  73. </MultiBinding>
  74. </RepeatButton.Visibility>
  75. <Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource DownArrow}"/>
  76. </RepeatButton>
  77. </Grid>
  78. </ControlTemplate>
  79. </Setter.Value>
  80. </Setter>
  81. </Style>
  82. <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
  83. <Border SnapsToDevicePixels="True" Background="{DynamicResource Color_BG_SubMenuBG}" MinWidth="{TemplateBinding ActualWidth}" BorderThickness="1" BorderBrush="{DynamicResource Color_BD_SubMenu}" Padding="5,0">
  84. <ContentPresenter Margin="0,5" HorizontalAlignment="Left"/>
  85. </Border>
  86. </ControlTemplate>
  87. <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
  88. <ControlTemplate.Resources>
  89. <Storyboard x:Key="OnMouseOver">
  90. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight">
  91. <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
  92. <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" KeySpline="0,0,1,0"/>
  93. </DoubleAnimationUsingKeyFrames>
  94. </Storyboard>
  95. <Storyboard x:Key="OnMouseOut">
  96. <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight">
  97. <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
  98. <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" KeySpline="0,0,0,1"/>
  99. </DoubleAnimationUsingKeyFrames>
  100. </Storyboard>
  101. </ControlTemplate.Resources>
  102. <Grid SnapsToDevicePixels="true">
  103. <Border x:Name="BG" BorderBrush="{DynamicResource Color_BD_Menu}" BorderThickness="1" Cursor="Hand" Background="{DynamicResource Color_BG_Menu}">
  104. <Border.Effect>
  105. <DropShadowEffect Color="#FFC6E9FF" ShadowDepth="0" BlurRadius="10"/>
  106. </Border.Effect>
  107. <Grid>
  108. <Border x:Name="Highlight" Background="{DynamicResource Color_BG_Menu_Highlight}" Opacity="0">
  109. <Border.Effect>
  110. <BlurEffect/>
  111. </Border.Effect>
  112. </Border>
  113. </Grid>
  114. </Border>
  115. <ContentPresenter x:Name="contentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  116. </ContentPresenter>
  117. <Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="1" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="2" Focusable="false" MinWidth="150" Grid.Column="1">
  118. <ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  119. <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
  120. <ItemsPresenter Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle" Cursor="Hand"/>
  121. </ScrollViewer>
  122. </ContentControl>
  123. </Popup>
  124. </Grid>
  125. <ControlTemplate.Triggers>
  126. <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  127. <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
  128. </Trigger>
  129. <Trigger Property="Icon" Value="{x:Null}"/>
  130. <Trigger Property="IsChecked" Value="true"/>
  131. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"/>
  132. <Trigger Property="IsHighlighted" Value="true">
  133. <Trigger.ExitActions>
  134. <BeginStoryboard x:Name="OnMouseOut_BeginStoryboard1" Storyboard="{StaticResource OnMouseOut}"/>
  135. </Trigger.ExitActions>
  136. <Trigger.EnterActions>
  137. <BeginStoryboard x:Name="OnMouseOver_BeginStoryboard" Storyboard="{StaticResource OnMouseOver}"/>
  138. </Trigger.EnterActions>
  139. </Trigger>
  140. <DataTrigger Binding="{Binding Selected}" Value="True">
  141. <Setter Property="Opacity" TargetName="Highlight" Value="1"/>
  142. </DataTrigger>
  143. <Trigger Property="IsKeyboardFocused" Value="true"/>
  144. <Trigger Property="IsSubmenuOpen" Value="true"/>
  145. <Trigger Property="IsEnabled" Value="false">
  146. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  147. </Trigger>
  148. </ControlTemplate.Triggers>
  149. </ControlTemplate>
  150. <SolidColorBrush x:Key="Menu_Main_BD" Color="#FF043963"/>
  151. <SolidColorBrush x:Key="Menu_Main_BG" Color="#FF346294"/>
  152. <SolidColorBrush x:Key="Menu_Main_BG_Highlight" Color="#FF91B0CF"/>
  153. <SolidColorBrush x:Key="Menu_Main_BG_Outer" Color="#FFCACACA"/>
  154. <SolidColorBrush x:Key="Menu_Main_BG_Outer_Red" Color="#FFFF0000"/>
  155. <SolidColorBrush x:Key="Menu_Main_BD_Highlight" Color="#FF88A0CE"/>
  156. <SolidColorBrush x:Key="Menu_Main_BD_Shadow" Color="#FF111A2B"/>
  157. <SolidColorBrush x:Key="Menu_Main_BG_Inner" Color="#FF346294"/>
  158. <SolidColorBrush x:Key="Menu_Main_BG_Outer_Highlight" Color="#FF91B0CD"/>
  159. <SolidColorBrush x:Key="Menu_Main_BG_Inner_Highlight" Color="#FF1A2730"/>
  160. <ControlTemplate x:Key="SubMunu_ShowOnTop" TargetType="{x:Type MenuItem}">
  161. <Grid x:Name="MainBG" SnapsToDevicePixels="true">
  162. <Border BorderBrush="{DynamicResource Menu_Main_BD}" BorderThickness="1" Background="{DynamicResource Menu_Main_BG_Outer}" CornerRadius="5">
  163. <Grid>
  164. <Rectangle x:Name="InnerBG" Height="10" Fill="{DynamicResource Menu_Main_BG_Inner}" VerticalAlignment="Center"/>
  165. <Border x:Name="BG" CornerRadius="3" Margin="2" Background="{DynamicResource Menu_Main_BG}">
  166. <ContentPresenter x:Name="contentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand" Margin="5,0">
  167. </ContentPresenter>
  168. </Border>
  169. </Grid>
  170. </Border>
  171. <Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="0" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Top" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-2" Focusable="false" MinWidth="150" Grid.Column="1">
  172. <ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  173. <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
  174. <ItemsPresenter Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle" Cursor="Hand"/>
  175. </ScrollViewer>
  176. </ContentControl>
  177. </Popup>
  178. </Grid>
  179. <ControlTemplate.Triggers>
  180. <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  181. <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
  182. </Trigger>
  183. <Trigger Property="Icon" Value="{x:Null}"/>
  184. <Trigger Property="IsChecked" Value="true"/>
  185. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"/>
  186. <Trigger Property="IsHighlighted" Value="true">
  187. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  188. <Setter Property="Fill" TargetName="InnerBG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  189. </Trigger>
  190. <DataTrigger Binding="{Binding Selected}" Value="True">
  191. <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
  192. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  193. <Setter Property="Fill" TargetName="InnerBG" Value="{DynamicResource Menu_Main_BG_Inner_Highlight}"/>
  194. <Setter Property="Margin" TargetName="BG" Value="3"/>
  195. <Setter Property="Margin" TargetName="MainBG" Value="-3"/>
  196. </DataTrigger>
  197. <Trigger Property="IsKeyboardFocused" Value="true"/>
  198. <Trigger Property="IsSubmenuOpen" Value="true"/>
  199. <Trigger Property="IsEnabled" Value="false">
  200. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  201. </Trigger>
  202. </ControlTemplate.Triggers>
  203. </ControlTemplate>
  204. <ControlTemplate x:Key="SubMunu_ShowOnTop_Red" TargetType="{x:Type MenuItem}">
  205. <Grid x:Name="MainBG" SnapsToDevicePixels="true">
  206. <Border BorderBrush="{DynamicResource Menu_Main_BD}" BorderThickness="1" Background="{DynamicResource Menu_Main_BG_Outer_Red}" CornerRadius="5">
  207. <Grid>
  208. <Rectangle x:Name="InnerBG" Height="10" Fill="{DynamicResource Menu_Main_BG_Inner}" VerticalAlignment="Center"/>
  209. <Border x:Name="BG" CornerRadius="3" Margin="2" Background="{DynamicResource Menu_Main_BG}">
  210. <ContentPresenter x:Name="contentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand" Margin="5,0">
  211. </ContentPresenter>
  212. </Border>
  213. </Grid>
  214. </Border>
  215. <Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="0" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Top" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-2" Focusable="false" MinWidth="150" Grid.Column="1">
  216. <ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  217. <ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
  218. <ItemsPresenter Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle" Cursor="Hand"/>
  219. </ScrollViewer>
  220. </ContentControl>
  221. </Popup>
  222. </Grid>
  223. <ControlTemplate.Triggers>
  224. <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  225. <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
  226. </Trigger>
  227. <Trigger Property="Icon" Value="{x:Null}"/>
  228. <Trigger Property="IsChecked" Value="true"/>
  229. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true"/>
  230. <Trigger Property="IsHighlighted" Value="true">
  231. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  232. <Setter Property="Fill" TargetName="InnerBG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  233. </Trigger>
  234. <DataTrigger Binding="{Binding Selected}" Value="True">
  235. <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
  236. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Menu_Main_BG_Highlight}"/>
  237. <Setter Property="Fill" TargetName="InnerBG" Value="{DynamicResource Menu_Main_BG_Inner_Highlight}"/>
  238. <Setter Property="Margin" TargetName="BG" Value="3"/>
  239. <Setter Property="Margin" TargetName="MainBG" Value="-3"/>
  240. </DataTrigger>
  241. <Trigger Property="IsKeyboardFocused" Value="true"/>
  242. <Trigger Property="IsSubmenuOpen" Value="true"/>
  243. <Trigger Property="IsEnabled" Value="false">
  244. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  245. </Trigger>
  246. </ControlTemplate.Triggers>
  247. </ControlTemplate>
  248. <ControlTemplate x:Key="SubMenu_ShowOnBottom" TargetType="{x:Type MenuItem}">
  249. <Grid>
  250. <Grid.ColumnDefinitions>
  251. <ColumnDefinition Width="10"/>
  252. <ColumnDefinition />
  253. <ColumnDefinition Width="10"/>
  254. </Grid.ColumnDefinitions>
  255. <Path x:Name="Left_Part" Data="M11.5,34.5 L10,34.5 0.5,0.5 11.5,0.5" Fill="{DynamicResource SubMenu_BG}" Margin="0,0,-3,0" Stretch="Fill" Stroke="{DynamicResource SubMenu_BD_Shadow}"/>
  256. <Path x:Name="Right_Part" Data="M11.5,34.5 L10,34.5 0.5,0.5 11.5,0.5" Fill="{DynamicResource SubMenu_BG}" Margin="-3,0,0,0" Stretch="Fill" Stroke="{DynamicResource SubMenu_BD_Shadow}" Grid.Column="2" RenderTransformOrigin="0.5,0.5">
  257. <Path.RenderTransform>
  258. <TransformGroup>
  259. <ScaleTransform ScaleY="1" ScaleX="-1"/>
  260. <SkewTransform AngleY="0" AngleX="0"/>
  261. <RotateTransform Angle="0"/>
  262. <TranslateTransform/>
  263. </TransformGroup>
  264. </Path.RenderTransform>
  265. </Path>
  266. <Border Grid.Column="1" x:Name="BG" BorderBrush="{DynamicResource SubMenu_BD_Shadow}" BorderThickness="0,1" Background="{DynamicResource SubMenu_BG}" Cursor="Hand">
  267. <ContentPresenter x:Name="contentPresenter" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="6,0" Cursor="Hand" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  268. </Border>
  269. <Rectangle x:Name="Top_Highlight" Height="1" Fill="{DynamicResource SubMenu_BD_Highlight}" Grid.ColumnSpan="3" Margin="1,1" VerticalAlignment="Top"/>
  270. <Rectangle x:Name="Bottom_Shadow" Height="1" Fill="{DynamicResource SubMenu_BD_Shadow}" Grid.Column="1" Margin="1,1" VerticalAlignment="Bottom"/>
  271. <Path x:Name="Left_Highlight" Data="M0,0 L1,0 11.5,35 10.5,35 z" Fill="{DynamicResource SubMenu_BD_Highlight}" Stretch="Fill" Margin="1,1,-2.5,1"/>
  272. <Path x:Name="Right_Shadow" Grid.Column="2" Data="M0,0 L1,0 -9.5,33 -10.5,33 z" Fill="{DynamicResource SubMenu_BD_Shadow}" Margin="-2.5,1,1,1" Stretch="Fill" />
  273. </Grid>
  274. <ControlTemplate.Triggers>
  275. <DataTrigger Binding="{Binding Selected}" Value="True">
  276. <Setter Property="Panel.ZIndex" Value="100"/>
  277. <Setter Property="Background" TargetName="BG" Value="{DynamicResource SubMenu_BG_Select}"/>
  278. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  279. <Setter Property="Fill" TargetName="Left_Part" Value="{DynamicResource SubMenu_BG_Select}"/>
  280. <Setter Property="Stroke" TargetName="Left_Part" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  281. <Setter Property="Fill" TargetName="Right_Part" Value="{DynamicResource SubMenu_BG_Select}"/>
  282. <Setter Property="Stroke" TargetName="Right_Part" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  283. <Setter Property="Fill" TargetName="Top_Highlight" Value="{DynamicResource SubMenu_BD_Shadow_Highlight}"/>
  284. <Setter Property="Fill" TargetName="Left_Highlight" Value="{DynamicResource SubMenu_BD_Shadow_Highlight}"/>
  285. <Setter Property="Fill" TargetName="Bottom_Shadow" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  286. <Setter Property="Fill" TargetName="Right_Shadow" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  287. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG_Select}"/>
  288. <Setter Property="FontSize" Value="16"/>
  289. </DataTrigger>
  290. <Trigger Property="IsHighlighted" Value="True">
  291. <Setter Property="Background" TargetName="BG" Value="{DynamicResource SubMenu_BG_Select}"/>
  292. <Setter Property="Fill" TargetName="Left_Part" Value="{DynamicResource SubMenu_BG_Select}"/>
  293. <Setter Property="Fill" TargetName="Right_Part" Value="{DynamicResource SubMenu_BG_Select}"/>
  294. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG_Select}"/>
  295. </Trigger>
  296. <Trigger Property="IsEnabled" Value="false">
  297. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  298. </Trigger>
  299. </ControlTemplate.Triggers>
  300. </ControlTemplate>
  301. <Style x:Key="BottomSubMenu" TargetType="MenuItem">
  302. <Setter Property="Command" Value="{Binding DataContext.MenuItemClickCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
  303. <Setter Property="CommandParameter" Value="{ Binding }"/>
  304. <Setter Property="Background" Value="Transparent"/>
  305. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG}"/>
  306. <Setter Property="FontFamily" Value="Arial"/>
  307. <Setter Property="MinWidth" Value="150"/>
  308. <Setter Property="Height" Value="32"/>
  309. <Setter Property="FontSize" Value="14"/>
  310. <Setter Property="FontWeight" Value="Normal"/>
  311. <Setter Property="Margin" Value="-3,0"/>
  312. <Setter Property="Template" Value="{StaticResource SubMenu_ShowOnBottom}"/>
  313. </Style>
  314. <Style x:Key="MainMenu" TargetType="MenuItem">
  315. <Setter Property="Command" Value="{Binding DataContext.MainMenuItemClickCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"/>
  316. <Setter Property="CommandParameter" Value="{ Binding }"/>
  317. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  318. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
  319. <Setter Property="Background" Value="Transparent"/>
  320. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  321. <Setter Property="FontSize" Value="16"/>
  322. <Setter Property="FontWeight" Value="Normal"/>
  323. <Setter Property="MinWidth" Value="130"/>
  324. <Setter Property="Margin" Value="0,0,30,0"/>
  325. <Setter Property="Height" Value="40"/>
  326. <Setter Property="Template" Value="{StaticResource SubMunu_ShowOnTop}"/>
  327. <Style.Triggers>
  328. <DataTrigger Binding="{Binding IsAlarm}" Value="True">
  329. <Setter Property="Template" Value="{StaticResource SubMunu_ShowOnTop_Red}"/>
  330. </DataTrigger>
  331. </Style.Triggers>
  332. </Style>
  333. </ResourceDictionary>