终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2 年前
2 年前
2 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <Application x:Class="BPASmart.RecipeManagement.App"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:BPASmart.RecipeManagement"
  5. StartupUri="MainWindow.xaml">
  6. <Application.Resources>
  7. <Style TargetType="{x:Type ContextMenu}">
  8. <Setter Property="Template">
  9. <Setter.Value>
  10. <ControlTemplate TargetType="{x:Type ContextMenu}">
  11. <Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0">
  12. <Border.BorderBrush>
  13. <SolidColorBrush Color="#104E8B" />
  14. </Border.BorderBrush>
  15. <ItemsPresenter/>
  16. </Border>
  17. <ControlTemplate.Triggers>
  18. <MultiTrigger>
  19. <MultiTrigger.Conditions>
  20. <Condition Property="IsMouseOver" Value="True"/>
  21. </MultiTrigger.Conditions>
  22. <MultiTrigger.EnterActions>
  23. <BeginStoryboard>
  24. <Storyboard>
  25. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
  26. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  27. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/>
  28. </DoubleAnimationUsingKeyFrames>
  29. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
  30. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  31. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
  32. </DoubleAnimationUsingKeyFrames>
  33. </Storyboard>
  34. </BeginStoryboard>
  35. </MultiTrigger.EnterActions>
  36. </MultiTrigger>
  37. </ControlTemplate.Triggers>
  38. </ControlTemplate>
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42. <Style TargetType="{x:Type MenuItem}">
  43. <Setter Property="Template">
  44. <Setter.Value>
  45. <ControlTemplate TargetType="{x:Type MenuItem}">
  46. <Border Margin="0,5" MinWidth="80" CornerRadius="5">
  47. <Border.Background>
  48. <SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
  49. </Border.Background>
  50. <StackPanel Orientation="Horizontal">
  51. <TextBlock Text=" "/>
  52. <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
  53. <TextBlock Text=" "/>
  54. <ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  55. </StackPanel>
  56. </Border>
  57. <ControlTemplate.Triggers>
  58. <MultiTrigger>
  59. <MultiTrigger.Conditions>
  60. <Condition Property="IsMouseOver" Value="True"/>
  61. </MultiTrigger.Conditions>
  62. <MultiTrigger.EnterActions>
  63. <BeginStoryboard>
  64. <Storyboard>
  65. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  66. <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" />
  67. <LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" />
  68. </ColorAnimationUsingKeyFrames>
  69. </Storyboard>
  70. </BeginStoryboard>
  71. </MultiTrigger.EnterActions>
  72. <MultiTrigger.ExitActions>
  73. <BeginStoryboard>
  74. <Storyboard>
  75. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  76. <LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" />
  77. <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" />
  78. </ColorAnimationUsingKeyFrames>
  79. </Storyboard>
  80. </BeginStoryboard>
  81. </MultiTrigger.ExitActions>
  82. </MultiTrigger>
  83. </ControlTemplate.Triggers>
  84. </ControlTemplate>
  85. </Setter.Value>
  86. </Setter>
  87. </Style>
  88. <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  89. <Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent">
  90. <Grid.ColumnDefinitions>
  91. <ColumnDefinition Width="*" />
  92. <ColumnDefinition Width="30" />
  93. </Grid.ColumnDefinitions>
  94. <Border
  95. Grid.ColumnSpan="2"
  96. Background="White"
  97. Opacity="0" />
  98. <Path
  99. x:Name="Arrow"
  100. Grid.Column="1"
  101. HorizontalAlignment="Center"
  102. VerticalAlignment="Center"
  103. Data="M 0 0 6 6 12 0 Z"
  104. Fill="Black"
  105. Stretch="None">
  106. <Path.Effect>
  107. <DropShadowEffect
  108. BlurRadius="10"
  109. Direction="90"
  110. Opacity="1"
  111. RenderingBias="Quality"
  112. ShadowDepth="0"
  113. Color="Transparent" />
  114. </Path.Effect>
  115. </Path>
  116. </Grid>
  117. <ControlTemplate.Triggers>
  118. <Trigger Property="IsChecked" Value="true">
  119. <Setter TargetName="Arrow" Property="RenderTransform">
  120. <Setter.Value>
  121. <RotateTransform Angle="180" CenterX="6" CenterY="3" />
  122. </Setter.Value>
  123. </Setter>
  124. <Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" />
  125. </Trigger>
  126. </ControlTemplate.Triggers>
  127. </ControlTemplate>
  128. <Style TargetType="{x:Type ComboBox}">
  129. <Setter Property="BorderThickness" Value="1" />
  130. <Setter Property="Background" Value="White"/>
  131. <Setter Property="ItemContainerStyle">
  132. <Setter.Value>
  133. <Style TargetType="ComboBoxItem">
  134. <Setter Property="Height" Value="25" />
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  138. <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
  139. <Border x:Name="_borderbg" Background="White" />
  140. <TextBlock
  141. x:Name="_txt"
  142. Margin="5,0,3,0"
  143. FontWeight="Black"
  144. HorizontalAlignment="Left"
  145. VerticalAlignment="Center"
  146. Foreground="Black"
  147. Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
  148. <Border
  149. x:Name="_border"
  150. Background="White"
  151. Opacity="0" />
  152. </Grid>
  153. <ControlTemplate.Triggers>
  154. <MultiTrigger>
  155. <MultiTrigger.Conditions>
  156. <Condition Property="IsSelected" Value="false" />
  157. <Condition Property="IsMouseOver" Value="true" />
  158. </MultiTrigger.Conditions>
  159. <Setter TargetName="_borderbg" Property="Background" Value="#AFEEEE" />
  160. <Setter TargetName="_txt" Property="Foreground" Value="black" />
  161. </MultiTrigger>
  162. </ControlTemplate.Triggers>
  163. </ControlTemplate>
  164. </Setter.Value>
  165. </Setter>
  166. </Style>
  167. </Setter.Value>
  168. </Setter>
  169. <Setter Property="Template">
  170. <Setter.Value>
  171. <ControlTemplate TargetType="{x:Type ComboBox}">
  172. <Grid>
  173. <Grid.ColumnDefinitions>
  174. <ColumnDefinition Width="0.7*" />
  175. <ColumnDefinition Width="0.3*" MaxWidth="30" />
  176. </Grid.ColumnDefinitions>
  177. <Border
  178. x:Name="_prybr"
  179. Grid.Column="0"
  180. Grid.ColumnSpan="2"
  181. BorderBrush="{TemplateBinding BorderBrush}"
  182. BorderThickness="{TemplateBinding BorderThickness}"
  183. CornerRadius="0" />
  184. <ContentPresenter
  185. x:Name="ContentSite"
  186. Margin="3,3,0,3"
  187. HorizontalAlignment="Center"
  188. VerticalAlignment="Center"
  189. Content="{TemplateBinding SelectionBoxItem}"
  190. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  191. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  192. IsHitTestVisible="False" />
  193. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  194. <ToggleButton
  195. x:Name="ToggleButton"
  196. Grid.Column="0"
  197. Grid.ColumnSpan="2"
  198. ClickMode="Press"
  199. Focusable="false"
  200. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  201. Template="{StaticResource ComboBoxToggleButton}" />
  202. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  203. <TextBox
  204. x:Name="PART_EditableTextBox"
  205. Margin="2,0,0,0"
  206. VerticalAlignment="Center"
  207. Background="White"
  208. BorderThickness="0"
  209. CaretBrush="{TemplateBinding Foreground}"
  210. Focusable="True"
  211. Foreground="{TemplateBinding Foreground}"
  212. IsReadOnly="{TemplateBinding IsReadOnly}"
  213. Visibility="Hidden" />
  214. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  215. <Popup
  216. x:Name="Popup"
  217. AllowsTransparency="True"
  218. Focusable="False"
  219. IsOpen="{TemplateBinding IsDropDownOpen}"
  220. Placement="Bottom"
  221. PopupAnimation="Slide">
  222. <Grid
  223. x:Name="DropDown"
  224. MinWidth="{TemplateBinding ActualWidth}"
  225. MaxHeight="150"
  226. SnapsToDevicePixels="True">
  227. <Border
  228. x:Name="DropDownBorder"
  229. BorderBrush="Black"
  230. BorderThickness="0" />
  231. <ScrollViewer
  232. Margin="1"
  233. CanContentScroll="True"
  234. HorizontalScrollBarVisibility="Auto"
  235. SnapsToDevicePixels="True"
  236. VerticalScrollBarVisibility="Auto">
  237. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  238. <!-- 一下可以设置列表背景色 -->
  239. <StackPanel
  240. Background="White"
  241. IsItemsHost="True"
  242. KeyboardNavigation.DirectionalNavigation="Contained" />
  243. </ScrollViewer>
  244. </Grid>
  245. </Popup>
  246. </Grid>
  247. <ControlTemplate.Triggers>
  248. <Trigger Property="IsEditable" Value="true">
  249. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  250. </Trigger>
  251. <Trigger Property="IsMouseOver" Value="True">
  252. <Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" />
  253. </Trigger>
  254. <Trigger Property="IsEnabled" Value="False">
  255. <Setter TargetName="ContentSite" Property="Opacity" Value="0.6" />
  256. </Trigger>
  257. </ControlTemplate.Triggers>
  258. </ControlTemplate>
  259. </Setter.Value>
  260. </Setter>
  261. </Style>
  262. </Application.Resources>
  263. </Application>