终端一体化运控平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

592 Zeilen
42 KiB

  1. <Application x:Class="BPASmartClient.MilkWithTea.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:BPASmartClient.MilkWithTea"
  5. StartupUri="MainWindow.xaml">
  6. <Application.Resources>
  7. <Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
  8. <Setter Property="Template">
  9. <Setter.Value>
  10. <ControlTemplate TargetType="{x:Type Thumb}">
  11. <Grid x:Name="Grid">
  12. <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent"/>
  13. <Border x:Name="Rectangle1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}"/>
  14. </Grid>
  15. <ControlTemplate.Triggers>
  16. <Trigger Property="Tag" Value="Horizontal">
  17. <Setter TargetName="Rectangle1" Property="Width" Value="Auto"/>
  18. <Setter TargetName="Rectangle1" Property="Height" Value="7"/>
  19. </Trigger>
  20. </ControlTemplate.Triggers>
  21. </ControlTemplate>
  22. </Setter.Value>
  23. </Setter>
  24. </Style>
  25. <!--滚动条样式-->
  26. <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
  27. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  28. <Setter Property="Foreground" Value="LightGray"/>
  29. <Setter Property="Background" Value="Transparent"/>
  30. <Setter Property="Width" Value="11"/>
  31. <Setter Property="Template">
  32. <Setter.Value>
  33. <ControlTemplate TargetType="{x:Type ScrollBar}">
  34. <Grid x:Name="GridRoot" Width="14" Background="{TemplateBinding Background}">
  35. <Grid.RowDefinitions>
  36. <RowDefinition Height="*"/>
  37. </Grid.RowDefinitions>
  38. <!--This is scrollbar track-->
  39. <Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="True" Focusable="False">
  40. <Track.Thumb>
  41. <Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}"/>
  42. </Track.Thumb>
  43. <Track.IncreaseRepeatButton>
  44. <RepeatButton x:Name="PageUp" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="False"/>
  45. </Track.IncreaseRepeatButton>
  46. <Track.DecreaseRepeatButton>
  47. <RepeatButton x:Name="PageDown" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="False"/>
  48. </Track.DecreaseRepeatButton>
  49. </Track>
  50. </Grid>
  51. <ControlTemplate.Triggers>
  52. <Trigger Property="IsEnabled" Value="False">
  53. <Setter TargetName="Thumb" Property="Visibility" Value="Collapsed"/>
  54. </Trigger>
  55. <Trigger Property="Orientation" Value="Horizontal">
  56. <Setter TargetName="GridRoot" Property="LayoutTransform">
  57. <Setter.Value>
  58. <RotateTransform Angle="-90"/>
  59. </Setter.Value>
  60. </Setter>
  61. <Setter TargetName="PART_Track" Property="LayoutTransform">
  62. <Setter.Value>
  63. <RotateTransform Angle="-90"/>
  64. </Setter.Value>
  65. </Setter>
  66. <Setter Property="Width" Value="Auto"/>
  67. <Setter Property="Height" Value="12"/>
  68. <Setter TargetName="Thumb" Property="Tag" Value="Horizontal"/>
  69. <Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand"/>
  70. <Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand"/>
  71. </Trigger>
  72. </ControlTemplate.Triggers>
  73. </ControlTemplate>
  74. </Setter.Value>
  75. </Setter>
  76. </Style>
  77. <!--datagrid标题栏样式-->
  78. <Style TargetType="DataGridColumnHeader">
  79. <Setter Property="SnapsToDevicePixels" Value="True" />
  80. <Setter Property="MinWidth" Value="0" />
  81. <Setter Property="MinHeight" Value="30" />
  82. <Setter Property="Foreground" Value="DarkSlateGray" />
  83. <Setter Property="FontSize" Value="18" />
  84. <Setter Property="Cursor" Value="Hand" />
  85. <Setter Property="Background" Value="White"/>
  86. <Setter Property="Template">
  87. <Setter.Value>
  88. <ControlTemplate TargetType="DataGridColumnHeader">
  89. <Grid>
  90. <Grid.ColumnDefinitions>
  91. <ColumnDefinition Width="*" />
  92. </Grid.ColumnDefinitions>
  93. <ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
  94. HorizontalAlignment="Center" />
  95. <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
  96. Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
  97. VerticalAlignment="Center" RenderTransformOrigin="1,1" />
  98. <Rectangle Width="1" Fill="Black" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
  99. </Grid>
  100. </ControlTemplate>
  101. </Setter.Value>
  102. </Setter>
  103. <Setter Property="Height" Value="25" />
  104. </Style>
  105. <Style TargetType="{x:Type DataGridCell}">
  106. <Setter Property="Background" Value="Transparent" />
  107. <Setter Property="BorderBrush" Value="#FF31879E" />
  108. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  109. <Setter Property="BorderThickness" Value="0" />
  110. <Setter Property="Template">
  111. <Setter.Value>
  112. <ControlTemplate TargetType="{x:Type DataGridCell}">
  113. <Border
  114. Background="{TemplateBinding Background}"
  115. BorderBrush="{TemplateBinding BorderBrush}"
  116. BorderThickness="{TemplateBinding BorderThickness}"
  117. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  118. Height="{TemplateBinding Height}"
  119. SnapsToDevicePixels="True">
  120. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  121. </Border>
  122. </ControlTemplate>
  123. </Setter.Value>
  124. </Setter>
  125. </Style>
  126. <Style x:Key="buttonNormal" TargetType="{x:Type Button}">
  127. <Setter Property="FocusVisualStyle">
  128. <Setter.Value>
  129. <Style>
  130. <Setter Property="Control.Template">
  131. <Setter.Value>
  132. <ControlTemplate>
  133. <Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
  134. </ControlTemplate>
  135. </Setter.Value>
  136. </Setter>
  137. </Style>
  138. </Setter.Value>
  139. </Setter>
  140. <Setter Property="Background" Value="#58B0ED"/>
  141. <Setter Property="BorderBrush" Value="#FF707070"/>
  142. <Setter Property="Foreground" Value="White"/>
  143. <Setter Property="BorderThickness" Value="0"/>
  144. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  145. <Setter Property="VerticalContentAlignment" Value="Center"/>
  146. <Setter Property="Padding" Value="1"/>
  147. <Setter Property="Template">
  148. <Setter.Value>
  149. <ControlTemplate TargetType="{x:Type Button}">
  150. <Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  151. <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  152. </Border>
  153. <ControlTemplate.Triggers>
  154. <Trigger Property="IsMouseOver" Value="True">
  155. <Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
  156. <Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
  157. </Trigger>
  158. <Trigger Property="IsPressed" Value="True">
  159. <Setter Property="Background" TargetName="border" Value="#58B0ED "/>
  160. <Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
  161. </Trigger>
  162. <Trigger Property="ToggleButton.IsChecked" Value="True">
  163. <Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
  164. <Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
  165. </Trigger>
  166. <Trigger Property="IsEnabled" Value="False">
  167. <Setter Property="Background" TargetName="border" Value="#58B0ED"/>
  168. <Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
  169. <Setter Property="Foreground" Value="White"/>
  170. </Trigger>
  171. </ControlTemplate.Triggers>
  172. </ControlTemplate>
  173. </Setter.Value>
  174. </Setter>
  175. </Style>
  176. <!--下拉列表样式-->
  177. <Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
  178. <Setter Property="IsExpanded" Value="False"></Setter>
  179. <Setter Property="Margin" Value="40,20"/>
  180. <Setter Property="FontSize" Value="20"/>
  181. <Setter Property="FontWeight" Value="Bold"/>
  182. <Setter Property="Foreground" Value="DarkSlateGray"/>
  183. <Setter Property="Template">
  184. <Setter.Value>
  185. <ControlTemplate TargetType="{x:Type Expander}">
  186. <Grid>
  187. <Grid.RowDefinitions>
  188. <RowDefinition Height="auto"></RowDefinition>
  189. <RowDefinition Height="auto"></RowDefinition>
  190. </Grid.RowDefinitions>
  191. <Border BorderThickness="1" Background="White" BorderBrush="Black" CornerRadius="10" Padding="10,2">
  192. <Grid>
  193. <Grid.ColumnDefinitions>
  194. <ColumnDefinition Width="200"/>
  195. <ColumnDefinition Width="50"/>
  196. </Grid.ColumnDefinitions>
  197. <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" VerticalAlignment="Center"/>
  198. <ToggleButton x:Name="HeaderSite" Grid.Column="1" Background="Transparent"
  199. ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
  200. IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  201. Style="{DynamicResource ExpanderToggleButtonStyle}" />
  202. </Grid>
  203. </Border>
  204. <ContentPresenter x:Name="ExpandSite" Grid.Row="1"
  205. ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
  206. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  207. </Grid>
  208. <ControlTemplate.Triggers>
  209. <Trigger Property="IsMouseOver" Value="True">
  210. <Setter Property="Background" Value=" #E1FFFF"/>
  211. </Trigger>
  212. <Trigger Property="IsExpanded" Value="True">
  213. <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
  214. </Trigger>
  215. </ControlTemplate.Triggers>
  216. </ControlTemplate>
  217. </Setter.Value>
  218. </Setter>
  219. </Style>
  220. <Style x:Key="ExpanderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
  221. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  222. <Setter Property="Height" Value="30" />
  223. <Setter Property="Background" Value="Transparent" />
  224. <Setter Property="Foreground" Value="DarkSlateGray"/>
  225. <Setter Property="FontSize" Value="22" />
  226. <Setter Property="FontFamily" Value="宋体" />
  227. <Setter Property="FontWeight" Value="Bold" />
  228. <Setter Property="BorderThickness" Value="0"/>
  229. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  230. <Setter Property="VerticalContentAlignment" Value="Center"/>
  231. <Setter Property="Width" Value="50"></Setter>
  232. <Setter Property="Padding" Value="5 5"/>
  233. <Setter Property="Template">
  234. <Setter.Value>
  235. <ControlTemplate TargetType="{x:Type ToggleButton}">
  236. <Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  237. Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  238. <Canvas x:Name="canvNormal" Visibility="Visible"
  239. Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  240. Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
  241. <Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="10"/>
  242. <Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
  243. </Canvas>
  244. <Canvas x:Name="canvChecked" Visibility="Hidden"
  245. Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
  246. Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
  247. <Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
  248. <Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="20"/>
  249. </Canvas>
  250. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  251. Margin="{TemplateBinding Padding}"
  252. RecognizesAccessKey="True"
  253. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  254. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  255. </Canvas>
  256. <ControlTemplate.Triggers>
  257. <Trigger Property="IsPressed" Value="true">
  258. <Setter Property="Background" Value="SlateGray" />
  259. </Trigger>
  260. <Trigger Property="IsChecked" Value="true">
  261. <Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
  262. <Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
  263. </Trigger>
  264. <Trigger Property="IsEnabled" Value="false">
  265. <Setter Property="Foreground" Value="Gray"/>
  266. </Trigger>
  267. </ControlTemplate.Triggers>
  268. </ControlTemplate>
  269. </Setter.Value>
  270. </Setter>
  271. </Style>
  272. <!--GroupBox-->
  273. <Style x:Key="GroupBoxStyle1" TargetType="{x:Type GroupBox}">
  274. <Setter Property="BorderBrush" Value="#D5DFE5"/>
  275. <Setter Property="BorderThickness" Value="1"/>
  276. <Setter Property="Margin" Value="20"/>
  277. <Setter Property="BorderThickness" Value="10"/>
  278. <Setter Property="Template">
  279. <Setter.Value>
  280. <ControlTemplate TargetType="{x:Type GroupBox}">
  281. <Grid SnapsToDevicePixels="true">
  282. <Grid.ColumnDefinitions>
  283. <ColumnDefinition Width="6"/>
  284. <ColumnDefinition Width="Auto"/>
  285. <ColumnDefinition Width="*"/>
  286. <ColumnDefinition Width="6"/>
  287. </Grid.ColumnDefinitions>
  288. <Grid.RowDefinitions>
  289. <RowDefinition Height="Auto"/>
  290. <RowDefinition Height="Auto" MinHeight="59"/>
  291. <RowDefinition Height="*"/>
  292. <RowDefinition Height="6"/>
  293. </Grid.RowDefinitions>
  294. <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="0" Grid.RowSpan="4" Background="Transparent" Margin="0,-0.25,0,0.25">
  295. <Border.Effect>
  296. <DropShadowEffect Color="#FFAAAAAA" Direction="350"/>
  297. </Border.Effect>
  298. </Border>
  299. <Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Right" Background="{x:Null}" Margin="0" Height="16.96" VerticalAlignment="Top"/>
  300. <ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.RowSpan="1"/>
  301. <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3">
  302. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
  303. <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
  304. </Border>
  305. </Border>
  306. <Grid x:Name="HeaderGrid" Height="47.2" VerticalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="1" Margin="0,7.982,-16,3.818" Grid.Row="1" HorizontalAlignment="Right">
  307. <Path Data="M12.19,0 L12.290733,14.847 -1.3000648E-08,14.847 z" Height="16.1" Margin="0,0,8.067,0" RenderTransformOrigin="0.499999978361064,0.499999995889058" Stretch="Fill" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="12.29" >
  308. <Path.Fill>
  309. <LinearGradientBrush EndPoint="0.466,2.201" StartPoint="0.5,0">
  310. <GradientStop Color="#C66A6A6A" Offset="1"/>
  311. <GradientStop Color="#E1434343" Offset="0.855"/>
  312. <GradientStop Color="#FFC6C6C6" Offset="0.11"/>
  313. </LinearGradientBrush>
  314. </Path.Fill>
  315. <Path.RenderTransform>
  316. <TransformGroup>
  317. <ScaleTransform/>
  318. <SkewTransform/>
  319. <RotateTransform Angle="90.087"/>
  320. <TranslateTransform Y="-6.04399277075815" X="6.0531771644038841"/>
  321. </TransformGroup>
  322. </Path.RenderTransform>
  323. </Path>
  324. <Border BorderBrush="Black" BorderThickness="0" Margin="0,8.061,0,0" CornerRadius="16,0,0,16" Background="White">
  325. <Border.Effect>
  326. <DropShadowEffect Direction="195" BlurRadius="10" Opacity="0.305" ShadowDepth="6"/>
  327. </Border.Effect>
  328. <Border x:Name="contentBorder" BorderBrush="Black" Margin="6,6,0,6" CornerRadius="16,0,0,16">
  329. <Border.Background>
  330. <LinearGradientBrush EndPoint="1.002,0.498" StartPoint="-0.024,0.502">
  331. <GradientStop Color=" #4682B4" Offset="0.027"/>
  332. <GradientStop Color=" #F0FFFF" Offset="0.994"/>
  333. </LinearGradientBrush>
  334. </Border.Background>
  335. <Grid>
  336. <ContentControl HorizontalAlignment="Left" Margin="20,0,23,0" VerticalAlignment="Center" Foreground="White">
  337. <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0" Width="212.323"/>
  338. </ContentControl>
  339. </Grid>
  340. </Border>
  341. </Border>
  342. </Grid>
  343. </Grid>
  344. </ControlTemplate>
  345. </Setter.Value>
  346. </Setter>
  347. </Style>
  348. <!--Combox-->
  349. <Style TargetType="{x:Type ComboBox}" x:Key="cmbstyle">
  350. <Setter Property="Background" Value="White"/>
  351. <Setter Property="ItemContainerStyle">
  352. <Setter.Value>
  353. <!--ComBoxItem-->
  354. <Style TargetType="ComboBoxItem">
  355. <Setter Property="MinHeight" Value="22"></Setter>
  356. <Setter Property="MinWidth" Value="60"></Setter>
  357. <Setter Property="Template">
  358. <Setter.Value>
  359. <ControlTemplate TargetType="ComboBoxItem">
  360. <Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
  361. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
  362. </Border>
  363. <ControlTemplate.Triggers>
  364. <Trigger Property="IsMouseOver" Value="True">
  365. <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
  366. </Trigger>
  367. <Trigger Property="IsHighlighted" Value="True">
  368. <Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
  369. </Trigger>
  370. </ControlTemplate.Triggers>
  371. </ControlTemplate>
  372. </Setter.Value>
  373. </Setter>
  374. </Style>
  375. </Setter.Value>
  376. </Setter>
  377. <Setter Property="Template">
  378. <Setter.Value>
  379. <ControlTemplate TargetType="{x:Type ComboBox}">
  380. <Border BorderThickness="0" CornerRadius="3" Width="{TemplateBinding Width}" Height="30" Background="{TemplateBinding Background}" >
  381. <Grid >
  382. <Grid.ColumnDefinitions>
  383. <ColumnDefinition Width="3*"/>
  384. <ColumnDefinition Width="*"/>
  385. </Grid.ColumnDefinitions>
  386. <Grid Grid.Column="0" x:Name="grid">
  387. <ToggleButton
  388. Width="{Binding ElementName=grid,Path=ActualWidth}"
  389. Height="{Binding ElementName=grid, Path=ActualHeight}"
  390. Content="{TemplateBinding Text}" VerticalAlignment="Center"
  391. HorizontalAlignment="Left" Margin="5,0,0,0"
  392. BorderThickness="0"
  393. Foreground="{TemplateBinding Foreground}"
  394. Background="{TemplateBinding Background}"
  395. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
  396. >
  397. <ToggleButton.Style >
  398. <Style TargetType="ToggleButton">
  399. <Setter Property="Background" Value="White"/>
  400. <Setter Property="Template">
  401. <Setter.Value>
  402. <ControlTemplate TargetType="ToggleButton">
  403. <Border Background="{TemplateBinding Background}" BorderThickness="0" >
  404. <TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
  405. </Border>
  406. </ControlTemplate>
  407. </Setter.Value>
  408. </Setter>
  409. <Style.Triggers>
  410. <Trigger Property="IsMouseOver" Value="True">
  411. <Setter Property="Background" Value="White"/>
  412. </Trigger>
  413. <Trigger Property="IsMouseOver" Value="False">
  414. <Setter Property="Background" Value="White"/>
  415. </Trigger>
  416. </Style.Triggers>
  417. </Style>
  418. </ToggleButton.Style>
  419. </ToggleButton>
  420. </Grid>
  421. <Grid Grid.Column="1" >
  422. <ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  423. Foreground="{TemplateBinding Foreground}"
  424. ClickMode="Press">
  425. <ToggleButton.Style>
  426. <Style TargetType="ToggleButton">
  427. <Setter Property="Background" Value="White"/>
  428. <Setter Property="Template">
  429. <Setter.Value>
  430. <ControlTemplate TargetType="ToggleButton">
  431. <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
  432. <Grid>
  433. <TextBlock Foreground="{TemplateBinding Foreground}" x:Name="arrow_tb" Text="&#xf02a9;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
  434. <TextBlock.RenderTransform>
  435. <TransformGroup>
  436. <ScaleTransform/>
  437. <SkewTransform/>
  438. <RotateTransform/>
  439. <TranslateTransform/>
  440. </TransformGroup>
  441. </TextBlock.RenderTransform>
  442. </TextBlock>
  443. </Grid>
  444. </Border>
  445. <ControlTemplate.Triggers>
  446. <Trigger Property="IsChecked" Value="True">
  447. </Trigger>
  448. <EventTrigger RoutedEvent="Checked">
  449. <BeginStoryboard>
  450. <Storyboard >
  451. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  452. <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
  453. <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
  454. </DoubleAnimationUsingKeyFrames>
  455. </Storyboard>
  456. </BeginStoryboard>
  457. </EventTrigger>
  458. <EventTrigger RoutedEvent="Unchecked">
  459. <BeginStoryboard>
  460. <Storyboard >
  461. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
  462. <EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
  463. <EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
  464. </DoubleAnimationUsingKeyFrames>
  465. </Storyboard>
  466. </BeginStoryboard>
  467. </EventTrigger>
  468. </ControlTemplate.Triggers>
  469. </ControlTemplate>
  470. </Setter.Value>
  471. </Setter>
  472. </Style>
  473. </ToggleButton.Style>
  474. </ToggleButton>
  475. </Grid>
  476. <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
  477. <Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
  478. <Border.Effect>
  479. <DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
  480. </Border.Effect>
  481. <ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
  482. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  483. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
  484. </ScrollViewer>
  485. </Border>
  486. </Popup>
  487. </Grid>
  488. <Border.Effect>
  489. <DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
  490. </Border.Effect>
  491. </Border>
  492. </ControlTemplate>
  493. </Setter.Value>
  494. </Setter>
  495. </Style>
  496. <!--开关按钮-->
  497. <Style x:Key="OpenCheckBoxStyle1" TargetType="{x:Type CheckBox}">
  498. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  499. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
  500. <Setter Property="Template">
  501. <Setter.Value>
  502. <ControlTemplate TargetType="{x:Type CheckBox}">
  503. <ControlTemplate.Resources>
  504. <Storyboard x:Key="OnChecking">
  505. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
  506. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="45"/>
  507. </DoubleAnimationUsingKeyFrames>
  508. </Storyboard>
  509. <Storyboard x:Key="OnUnchecking">
  510. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
  511. <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
  512. </DoubleAnimationUsingKeyFrames>
  513. <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(FrameworkElement.Margin)">
  514. <SplineThicknessKeyFrame KeyTime="00:00:00.3000000" Value="1,1,1,1"/>
  515. </ThicknessAnimationUsingKeyFrames>
  516. </Storyboard>
  517. </ControlTemplate.Resources>
  518. <DockPanel x:Name="dockPanel">
  519. <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True" VerticalAlignment="Center"/>
  520. <Grid Margin="5,5,0,5" Width="80" Background="#FFC0CCD9">
  521. <TextBlock Text="OFF" TextWrapping="Wrap" FontWeight="Bold" FontSize="16" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0" Foreground="Red"/>
  522. <TextBlock HorizontalAlignment="Left" Margin="2,0,0,0" FontSize="16" FontWeight="Bold" Text="ON" VerticalAlignment="Center" TextWrapping="Wrap" Foreground="#008000"/>
  523. <Border HorizontalAlignment="Left" x:Name="slider" Width="33" BorderThickness="1,1,1,1" CornerRadius="3,3,3,3" RenderTransformOrigin="0.5,0.5" Margin="1,1,1,1">
  524. <Border.RenderTransform>
  525. <TransformGroup>
  526. <ScaleTransform ScaleX="1" ScaleY="1"/>
  527. <SkewTransform AngleX="0" AngleY="0"/>
  528. <RotateTransform Angle="0"/>
  529. <TranslateTransform X="0" Y="0"/>
  530. </TransformGroup>
  531. </Border.RenderTransform>
  532. <Border.BorderBrush>
  533. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  534. <GradientStop Color="#FFFFFFFF" Offset="0"/>
  535. <GradientStop Color="#FF4490FF" Offset="1"/>
  536. </LinearGradientBrush>
  537. </Border.BorderBrush>
  538. <Border.Background>
  539. <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
  540. <GradientStop Color="#FF8AB4FF" Offset="1"/>
  541. <GradientStop Color="#FFD1E2FF" Offset="0"/>
  542. </LinearGradientBrush>
  543. </Border.Background>
  544. </Border>
  545. </Grid>
  546. </DockPanel>
  547. <ControlTemplate.Triggers>
  548. <Trigger Property="IsChecked" Value="True">
  549. <Trigger.ExitActions>
  550. <BeginStoryboard Storyboard="{StaticResource OnUnchecking}" x:Name="OnUnchecking_BeginStoryboard"/>
  551. </Trigger.ExitActions>
  552. <Trigger.EnterActions>
  553. <BeginStoryboard Storyboard="{StaticResource OnChecking}" x:Name="OnChecking_BeginStoryboard"/>
  554. </Trigger.EnterActions>
  555. </Trigger>
  556. <Trigger Property="IsEnabled" Value="False">
  557. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  558. </Trigger>
  559. </ControlTemplate.Triggers>
  560. </ControlTemplate>
  561. </Setter.Value>
  562. </Setter>
  563. </Style>
  564. </Application.Resources>
  565. </Application>