MenuItemStyle.xaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style x:Key="Main_MenuItem" TargetType="MenuItem">
  4. <Setter Property="Template">
  5. <Setter.Value>
  6. <ControlTemplate TargetType="{x:Type MenuItem}">
  7. <Border x:Name="border" Background="#FFFFFF" BorderThickness="0" Height="30">
  8. <Grid Margin="20,0,20,0">
  9. <ContentPresenter x:Name="contentPresenter"
  10. ContentSource="Header"
  11. TextBlock.Foreground="#000000"
  12. TextBlock.FontFamily="SegoeUI"
  13. TextBlock.FontSize="15"
  14. HorizontalAlignment="Center"
  15. VerticalAlignment="Center">
  16. </ContentPresenter>
  17. </Grid>
  18. </Border>
  19. <ControlTemplate.Triggers>
  20. <Trigger Property="IsEnabled" Value="False">
  21. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#6A6A6A"></Setter>
  22. <Setter TargetName="border" Property="Background" Value="#EFEFEF"></Setter>
  23. </Trigger>
  24. <Trigger Property="IsHighlighted" Value="True">
  25. <Setter Property="Background" TargetName="border" Value="#2894FF"></Setter>
  26. <Setter Property="BorderBrush" TargetName="border" Value="#2894FF"></Setter>
  27. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#FFFFFF"></Setter>
  28. </Trigger>
  29. </ControlTemplate.Triggers>
  30. </ControlTemplate>
  31. </Setter.Value>
  32. </Setter>
  33. </Style>
  34. <Style x:Key="Dropdown_MenuItem" TargetType="MenuItem">
  35. <Setter Property="Template">
  36. <Setter.Value>
  37. <ControlTemplate TargetType="{x:Type MenuItem}">
  38. <Border x:Name="border"
  39. Background="#FFFFFF"
  40. BorderThickness="0"
  41. Height="40">
  42. <Grid>
  43. <ContentPresenter x:Name="contentPresenter"
  44. ContentSource="Header"
  45. TextBlock.Foreground="#000000"
  46. TextBlock.FontFamily="SegoeUI"
  47. TextBlock.FontSize="15"
  48. HorizontalAlignment="Center"
  49. VerticalAlignment="Center"
  50. Margin="20,0,20,0">
  51. </ContentPresenter>
  52. <Popup x:Name="Part_Popup"
  53. AllowsTransparency="True"
  54. IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
  55. Placement="Bottom"
  56. PopupAnimation="Fade">
  57. <Border Name="SubMenuBorder"
  58. Background="#484546"
  59. BorderBrush="#484546">
  60. <ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  61. <Grid RenderOptions.ClearTypeHint="Enabled">
  62. <Canvas HorizontalAlignment="Left" VerticalAlignment="Top"></Canvas>
  63. <ItemsPresenter x:Name="ItemsPresenter"></ItemsPresenter>
  64. </Grid>
  65. </ScrollViewer>
  66. </Border>
  67. </Popup>
  68. </Grid>
  69. </Border>
  70. <ControlTemplate.Triggers>
  71. <Trigger Property="IsEnabled" Value="False">
  72. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#6A6A6A"></Setter>
  73. <Setter TargetName="border" Property="Background" Value="#EFEFEF"></Setter>
  74. </Trigger>
  75. <Trigger Property="IsSuspendingPopupAnimation"
  76. Value="True">
  77. <Setter Property="PopupAnimation"
  78. TargetName="Part_Popup"
  79. Value="None"></Setter>
  80. </Trigger>
  81. <Trigger Property="IsHighlighted" Value="True">
  82. <Setter Property="Background" TargetName="border" Value="#2894FF"></Setter>
  83. <Setter Property="BorderBrush" TargetName="border" Value="#2894FF"></Setter>
  84. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#FFFFFF"></Setter>
  85. </Trigger>
  86. </ControlTemplate.Triggers>
  87. </ControlTemplate>
  88. </Setter.Value>
  89. </Setter>
  90. </Style>
  91. <Style x:Key="Sub_MenuItem" TargetType="MenuItem">
  92. <Setter Property="Template">
  93. <Setter.Value>
  94. <ControlTemplate TargetType="{x:Type MenuItem}">
  95. <Border x:Name="border"
  96. Background="#FFFFFF"
  97. BorderThickness="0"
  98. Height="40" >
  99. <Grid Margin="20,0,20,0">
  100. <ContentPresenter x:Name="contentPresenter"
  101. ContentSource="Header"
  102. TextBlock.Foreground="#000000"
  103. TextBlock.FontFamily="SegoeUI"
  104. TextBlock.FontSize="15"
  105. HorizontalAlignment="Left"
  106. VerticalAlignment="Center">
  107. </ContentPresenter>
  108. </Grid>
  109. </Border>
  110. <ControlTemplate.Triggers>
  111. <Trigger Property="IsEnabled" Value="False">
  112. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#6A6A6A"></Setter>
  113. <Setter TargetName="border" Property="Background" Value="#EFEFEF"></Setter>
  114. </Trigger>
  115. <Trigger Property="IsHighlighted" Value="True">
  116. <Setter Property="Background" TargetName="border" Value="#2894FF"></Setter>
  117. <Setter Property="BorderBrush" TargetName="border" Value="#2894FF"></Setter>
  118. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#FFFFFF"></Setter>
  119. </Trigger>
  120. </ControlTemplate.Triggers>
  121. </ControlTemplate>
  122. </Setter.Value>
  123. </Setter>
  124. </Style>
  125. <Style x:Key="Sub_Dropdown_MenuItem" TargetType="MenuItem">
  126. <Setter Property="Template">
  127. <Setter.Value>
  128. <ControlTemplate TargetType="{x:Type MenuItem}">
  129. <Border x:Name="border"
  130. Background="#FFFFFF"
  131. BorderThickness="0"
  132. Height="40">
  133. <Grid Margin="20,0,0,0">
  134. <ContentPresenter x:Name="contentPresenter"
  135. ContentSource="Header"
  136. TextBlock.Foreground="#000000"
  137. TextBlock.FontFamily="SegoeUI"
  138. TextBlock.FontSize="15"
  139. HorizontalAlignment="Left"
  140. VerticalAlignment="Center"
  141. >
  142. </ContentPresenter>
  143. <Popup x:Name="Part_Popup"
  144. AllowsTransparency="True"
  145. IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
  146. Placement="Right"
  147. PopupAnimation="Fade">
  148. <Border Name="SubMenuBorder"
  149. Background="#484546"
  150. BorderBrush="#FFFFFF">
  151. <ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
  152. <Grid RenderOptions.ClearTypeHint="Enabled">
  153. <Canvas HorizontalAlignment="Left" VerticalAlignment="Top"></Canvas>
  154. <ItemsPresenter x:Name="ItemsPresenter"></ItemsPresenter>
  155. </Grid>
  156. </ScrollViewer>
  157. </Border>
  158. </Popup>
  159. </Grid>
  160. </Border>
  161. <ControlTemplate.Triggers>
  162. <Trigger Property="IsEnabled" Value="False">
  163. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#6A6A6A"></Setter>
  164. <Setter TargetName="border" Property="Background" Value="#EFEFEF"></Setter>
  165. </Trigger>
  166. <Trigger Property="IsHighlighted" Value="True">
  167. <Setter Property="Background" TargetName="border" Value="#2894FF"></Setter>
  168. <Setter Property="BorderBrush" TargetName="border" Value="#2894FF"></Setter>
  169. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#FFFFFF"></Setter>
  170. </Trigger>
  171. </ControlTemplate.Triggers>
  172. </ControlTemplate>
  173. </Setter.Value>
  174. </Setter>
  175. </Style>
  176. <Style x:Key="Dropdown_Sub_MenuItem" TargetType="MenuItem">
  177. <Setter Property="Template">
  178. <Setter.Value>
  179. <ControlTemplate TargetType="{x:Type MenuItem}">
  180. <Border x:Name="border"
  181. Background="#FFFFFF"
  182. BorderThickness="0"
  183. Height="40">
  184. <Grid Margin="20,0,20,0">
  185. <ContentPresenter x:Name="contentPresenter"
  186. ContentSource="Header"
  187. TextBlock.Foreground="#000000"
  188. TextBlock.FontFamily="SegoeUI"
  189. TextBlock.FontSize="15"
  190. HorizontalAlignment="Left"
  191. VerticalAlignment="Center">
  192. </ContentPresenter>
  193. </Grid>
  194. </Border>
  195. <ControlTemplate.Triggers>
  196. <Trigger Property="IsEnabled" Value="False">
  197. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#6A6A6A"></Setter>
  198. <Setter TargetName="border" Property="Background" Value="#EFEFEF"></Setter>
  199. </Trigger>
  200. <Trigger Property="IsHighlighted" Value="True">
  201. <Setter Property="Background" TargetName="border" Value="#2894FF"></Setter>
  202. <Setter Property="BorderBrush" TargetName="border" Value="#2894FF"></Setter>
  203. <Setter Property="TextBlock.Foreground" TargetName="contentPresenter" Value="#FFFFFF"></Setter>
  204. </Trigger>
  205. </ControlTemplate.Triggers>
  206. </ControlTemplate>
  207. </Setter.Value>
  208. </Setter>
  209. </Style>
  210. </ResourceDictionary>