终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

739 rader
43 KiB

  1. <Application x:Class="BPASmart.UserManagement.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.UserManagement"
  5. StartupUri="MainWindow.xaml">
  6. <Application.Resources>
  7. <SolidColorBrush x:Key="commanTextblock" Color="#FF2AB2E7"/>
  8. <SolidColorBrush x:Key="selectedColor" Color=" #4169E1"/>
  9. <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/>
  10. <!--#region ScrollViewer-->
  11. <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
  12. <Setter Property="OverridesDefaultStyle" Value="true"/>
  13. <Setter Property="IsTabStop" Value="false"/>
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate TargetType="{x:Type Thumb}">
  17. <!--滚动条颜色和圆角设置-->
  18. <Rectangle Name="thumbRect" Fill="#03ffea" RadiusX="3" RadiusY="3"/>
  19. <!--鼠标拉动滚动条时的颜色-->
  20. <ControlTemplate.Triggers>
  21. <Trigger Property="IsMouseOver" Value="True">
  22. <Setter Property="Fill" Value="CornflowerBlue" TargetName="thumbRect" />
  23. </Trigger>
  24. </ControlTemplate.Triggers>
  25. </ControlTemplate>
  26. </Setter.Value>
  27. </Setter>
  28. </Style>
  29. <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  30. <Setter Property="SnapsToDevicePixels" Value="True" />
  31. <Setter Property="OverridesDefaultStyle" Value="true" />
  32. <Setter Property="IsTabStop" Value="false" />
  33. <Setter Property="Focusable" Value="false" />
  34. <Setter Property="Template">
  35. <Setter.Value>
  36. <ControlTemplate TargetType="{x:Type RepeatButton}">
  37. <Border Background="Transparent" />
  38. </ControlTemplate>
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42. <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
  43. <Grid>
  44. <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
  45. <Track x:Name="PART_Track" IsDirectionReversed="true">
  46. <Track.DecreaseRepeatButton>
  47. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
  48. </Track.DecreaseRepeatButton>
  49. <Track.Thumb>
  50. <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
  51. </Track.Thumb>
  52. <Track.IncreaseRepeatButton>
  53. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
  54. </Track.IncreaseRepeatButton>
  55. </Track>
  56. </Grid>
  57. </ControlTemplate>
  58. <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
  59. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  60. <Grid.ColumnDefinitions>
  61. <ColumnDefinition Width="*"/>
  62. <ColumnDefinition Width="Auto"/>
  63. </Grid.ColumnDefinitions>
  64. <Grid.RowDefinitions>
  65. <RowDefinition Height="*"/>
  66. <RowDefinition Height="Auto"/>
  67. </Grid.RowDefinitions>
  68. <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
  69. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  70. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
  71. Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  72. Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
  73. Template="{StaticResource VerticalScrollBar}"/>
  74. <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
  75. </Grid>
  76. </ControlTemplate>
  77. <ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}">
  78. <!--View区域背景色-->
  79. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  80. <Grid.ColumnDefinitions>
  81. <ColumnDefinition Width="*"/>
  82. <ColumnDefinition Width="Auto"/>
  83. </Grid.ColumnDefinitions>
  84. <Grid.RowDefinitions>
  85. <RowDefinition Height="*"/>
  86. <RowDefinition Height="Auto"/>
  87. </Grid.RowDefinitions>
  88. <Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/>
  89. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  90. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource MyScrollBarStyle}"/>
  91. <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource MyScrollBarStyle}"/>
  92. </Grid>
  93. </ControlTemplate>
  94. <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  95. <Setter Property="OverridesDefaultStyle" Value="true"/>
  96. <Setter Property="Background" Value="Transparent"/>
  97. <Setter Property="Focusable" Value="false"/>
  98. <Setter Property="IsTabStop" Value="false"/>
  99. <Setter Property="Template">
  100. <Setter.Value>
  101. <ControlTemplate TargetType="{x:Type RepeatButton}">
  102. <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
  103. </ControlTemplate>
  104. </Setter.Value>
  105. </Setter>
  106. </Style>
  107. <!--#endregion-->
  108. <!--#region右键菜单-->
  109. <Style TargetType="{x:Type ContextMenu}">
  110. <Setter Property="Template">
  111. <Setter.Value>
  112. <ControlTemplate TargetType="{x:Type ContextMenu}">
  113. <Border x:Name="Border" CornerRadius="4" Background="#1E2D45" BorderThickness="1" Margin="0"
  114. Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
  115. <Border.BorderBrush>
  116. <SolidColorBrush Color="#104E8B" />
  117. </Border.BorderBrush>
  118. <ItemsPresenter/>
  119. </Border>
  120. <ControlTemplate.Triggers>
  121. <MultiTrigger>
  122. <MultiTrigger.Conditions>
  123. <Condition Property="IsMouseOver" Value="True"/>
  124. </MultiTrigger.Conditions>
  125. <MultiTrigger.EnterActions>
  126. <BeginStoryboard>
  127. <Storyboard>
  128. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
  129. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  130. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="130"/>
  131. </DoubleAnimationUsingKeyFrames>
  132. <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
  133. <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
  134. <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
  135. </DoubleAnimationUsingKeyFrames>
  136. </Storyboard>
  137. </BeginStoryboard>
  138. </MultiTrigger.EnterActions>
  139. </MultiTrigger>
  140. </ControlTemplate.Triggers>
  141. </ControlTemplate>
  142. </Setter.Value>
  143. </Setter>
  144. </Style>
  145. <Style TargetType="{x:Type MenuItem}">
  146. <Setter Property="Template">
  147. <Setter.Value>
  148. <ControlTemplate TargetType="{x:Type MenuItem}">
  149. <Border Margin="0,5,0,0" CornerRadius="5" >
  150. <Border.Background>
  151. <SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
  152. </Border.Background>
  153. <StackPanel Orientation="Horizontal">
  154. <TextBlock Text=" "/>
  155. <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
  156. <TextBlock Text=" "/>
  157. <ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  158. </StackPanel>
  159. </Border>
  160. <ControlTemplate.Triggers>
  161. <MultiTrigger>
  162. <MultiTrigger.Conditions>
  163. <Condition Property="IsMouseOver" Value="True"/>
  164. </MultiTrigger.Conditions>
  165. <MultiTrigger.EnterActions>
  166. <BeginStoryboard>
  167. <Storyboard>
  168. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  169. <LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.0020000" />
  170. <LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.320000" />
  171. </ColorAnimationUsingKeyFrames>
  172. </Storyboard>
  173. </BeginStoryboard>
  174. </MultiTrigger.EnterActions>
  175. <MultiTrigger.ExitActions>
  176. <BeginStoryboard>
  177. <Storyboard>
  178. <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
  179. <LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.0020000" />
  180. <LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.320000" />
  181. </ColorAnimationUsingKeyFrames>
  182. </Storyboard>
  183. </BeginStoryboard>
  184. </MultiTrigger.ExitActions>
  185. </MultiTrigger>
  186. </ControlTemplate.Triggers>
  187. </ControlTemplate>
  188. </Setter.Value>
  189. </Setter>
  190. </Style>
  191. <!--#endregion-->
  192. <!--#region button样式-->
  193. <Style x:Key="CommonButton" TargetType="{x:Type Button}">
  194. <Setter Property="Background" Value="Transparent"/>
  195. <Setter Property="Foreground" Value="#FF2AB2E7"/>
  196. <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
  197. <Setter Property="FontFamily" Value="楷体"/>
  198. <Setter Property="Template">
  199. <Setter.Value>
  200. <ControlTemplate TargetType="{x:Type Button}">
  201. <Border x:Name="border" CornerRadius="5" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
  202. Padding="5,2">
  203. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
  204. </Border>
  205. <ControlTemplate.Triggers>
  206. <Trigger Property="IsMouseOver" Value="True">
  207. <Setter TargetName="border" Property="Background" Value="{DynamicResource selectedColor}"/>
  208. <Setter TargetName="border" Property="BorderBrush" Value="#F0FFFF"/>
  209. <Setter Property="Foreground" Value="white"/>
  210. </Trigger>
  211. </ControlTemplate.Triggers>
  212. </ControlTemplate>
  213. </Setter.Value>
  214. </Setter>
  215. </Style>
  216. <Style x:Key="ButtonStyle" TargetType="Button">
  217. <Setter Property="Background" Value="Transparent"/>
  218. <Setter Property="Foreground" Value="#FF2AB2E7"/>
  219. <Setter Property="BorderBrush" Value="Transparent"/>
  220. <Setter Property="BorderThickness" Value="0"/>
  221. <Setter Property="FontSize" Value="14"/>
  222. <Setter Property="Template">
  223. <Setter.Value>
  224. <ControlTemplate TargetType="{x:Type Button}">
  225. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  226. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  227. </Border>
  228. <ControlTemplate.Triggers>
  229. <Trigger Property="IsMouseOver" Value="True">
  230. <Setter TargetName="border" Property="Background" Value="#442AB2E7"/>
  231. </Trigger>
  232. </ControlTemplate.Triggers>
  233. </ControlTemplate>
  234. </Setter.Value>
  235. </Setter>
  236. </Style>
  237. <Style x:Key="ButtontextStyle" TargetType="Button">
  238. <Setter Property="Background" Value="Transparent"/>
  239. <Setter Property="Foreground" Value="#FF2AB2E7"/>
  240. <Setter Property="BorderBrush" Value="Transparent"/>
  241. <Setter Property="BorderThickness" Value="0"/>
  242. <Setter Property="FontSize" Value="14"/>
  243. <Setter Property="Template">
  244. <Setter.Value>
  245. <ControlTemplate TargetType="{x:Type Button}">
  246. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  247. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  248. </Border>
  249. <ControlTemplate.Triggers>
  250. <Trigger Property="IsMouseOver" Value="True">
  251. <Setter TargetName="border" Property="Background" Value="Transparent"/>
  252. </Trigger>
  253. </ControlTemplate.Triggers>
  254. </ControlTemplate>
  255. </Setter.Value>
  256. </Setter>
  257. </Style>
  258. <!--#endregion-->
  259. <!--#region 用户输入框样式-->
  260. <Style x:Key="UserTextBoxStyle" TargetType="TextBox">
  261. <Setter Property="Background" Value="Transparent" />
  262. <Setter Property="CaretBrush" Value="#009DFF" />
  263. <Setter Property="Template">
  264. <Setter.Value>
  265. <ControlTemplate TargetType="TextBox">
  266. <Border
  267. x:Name="border"
  268. Background="{TemplateBinding Background}"
  269. BorderBrush="{TemplateBinding BorderBrush}"
  270. BorderThickness="{TemplateBinding BorderThickness}"
  271. CornerRadius="5"
  272. SnapsToDevicePixels="true">
  273. <Grid>
  274. <Grid.ColumnDefinitions>
  275. <ColumnDefinition Width="40" />
  276. <ColumnDefinition />
  277. </Grid.ColumnDefinitions>
  278. <TextBlock
  279. x:Name="PasswordTextBlock"
  280. HorizontalAlignment="Center"
  281. VerticalAlignment="Center"
  282. FontFamily="../Fonts/#iconfont"
  283. FontSize="{TemplateBinding FontSize}"
  284. Foreground="{TemplateBinding BorderBrush}"
  285. Text="&#xe633;"/>
  286. <TextBlock
  287. Name="markText"
  288. Grid.Column="1"
  289. Margin="10,0"
  290. HorizontalAlignment="Left"
  291. VerticalAlignment="Center"
  292. FontSize="{TemplateBinding FontSize}"
  293. Foreground="#88009dff"
  294. Text="请输入账号名称"
  295. Visibility="Collapsed" />
  296. <ScrollViewer
  297. x:Name="PART_ContentHost"
  298. Grid.Column="1"
  299. MinHeight="20"
  300. VerticalAlignment="Center"
  301. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  302. </Grid>
  303. </Border>
  304. <ControlTemplate.Triggers>
  305. <MultiTrigger>
  306. <MultiTrigger.Conditions>
  307. <Condition Property="IsMouseOver" Value="false"/>
  308. <Condition Property="IsKeyboardFocused" Value="true"/>
  309. </MultiTrigger.Conditions>
  310. <MultiTrigger.Setters>
  311. <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
  312. </MultiTrigger.Setters>
  313. </MultiTrigger>
  314. <Trigger Property="IsEnabled" Value="false">
  315. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  316. </Trigger>
  317. <Trigger Property="IsMouseOver" Value="true">
  318. <Setter TargetName="border" Property="BorderBrush" Value="#447EB4EA" />
  319. </Trigger>
  320. <!--<Trigger Property="IsKeyboardFocused" Value="true">
  321. <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
  322. </Trigger>-->
  323. <DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
  324. <Setter TargetName="markText" Property="Visibility" Value="Visible" />
  325. </DataTrigger>
  326. </ControlTemplate.Triggers>
  327. </ControlTemplate>
  328. </Setter.Value>
  329. </Setter>
  330. </Style>
  331. <!--#endregion-->
  332. <!--#region 密码输入框样式-->
  333. <Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
  334. <Setter Property="Background" Value="Transparent" />
  335. <Setter Property="FontFamily" Value="Times New Roman" />
  336. <Setter Property="PasswordChar" Value="●" />
  337. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  338. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  339. <Setter Property="HorizontalContentAlignment" Value="Left" />
  340. <Setter Property="Padding" Value="1" />
  341. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  342. <Setter Property="AllowDrop" Value="true" />
  343. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  344. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  345. <Setter Property="CaretBrush" Value="#009DFF" />
  346. <Setter Property="Template">
  347. <Setter.Value>
  348. <ControlTemplate TargetType="{x:Type PasswordBox}">
  349. <Border
  350. x:Name="Bd"
  351. Background="{TemplateBinding Background}"
  352. BorderBrush="{TemplateBinding BorderBrush}"
  353. BorderThickness="{TemplateBinding BorderThickness}"
  354. CornerRadius="5"
  355. SnapsToDevicePixels="true">
  356. <Grid>
  357. <Grid.ColumnDefinitions>
  358. <ColumnDefinition Width="40" />
  359. <ColumnDefinition />
  360. </Grid.ColumnDefinitions>
  361. <TextBlock
  362. x:Name="UserTextBlock"
  363. HorizontalAlignment="Center"
  364. VerticalAlignment="Center"
  365. FontFamily="../../Fonts/#iconfont"
  366. FontSize="{TemplateBinding FontSize}"
  367. Foreground="{TemplateBinding BorderBrush}"
  368. Text="&#xe611;" />
  369. <ScrollViewer
  370. x:Name="PART_ContentHost"
  371. Grid.Column="1"
  372. MinHeight="{TemplateBinding FontSize}"
  373. VerticalAlignment="Center"
  374. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  375. </Grid>
  376. </Border>
  377. <ControlTemplate.Triggers>
  378. <MultiTrigger>
  379. <MultiTrigger.Conditions>
  380. <Condition Property="IsMouseOver" Value="false"/>
  381. <Condition Property="IsKeyboardFocused" Value="true"/>
  382. </MultiTrigger.Conditions>
  383. <MultiTrigger.Setters>
  384. <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
  385. <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
  386. </MultiTrigger.Setters>
  387. </MultiTrigger>
  388. <Trigger Property="IsEnabled" Value="false">
  389. <Setter TargetName="Bd" Property="Opacity" Value="0.56" />
  390. <Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
  391. </Trigger>
  392. <Trigger Property="IsMouseOver" Value="true">
  393. <Setter TargetName="Bd" Property="BorderBrush" Value="#447EB4EA" />
  394. <Setter TargetName="UserTextBlock" Property="Foreground" Value="#447EB4EA" />
  395. </Trigger>
  396. <!--<Trigger Property="IsKeyboardFocused" Value="true">
  397. <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
  398. <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
  399. </Trigger>-->
  400. </ControlTemplate.Triggers>
  401. </ControlTemplate>
  402. </Setter.Value>
  403. </Setter>
  404. <Style.Triggers>
  405. <MultiTrigger>
  406. <MultiTrigger.Conditions>
  407. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  408. <Condition Property="IsSelectionActive" Value="false" />
  409. </MultiTrigger.Conditions>
  410. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  411. </MultiTrigger>
  412. </Style.Triggers>
  413. </Style>
  414. <!--#endregion-->
  415. <!--#region Combox-->
  416. <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  417. <Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent">
  418. <Grid.ColumnDefinitions>
  419. <ColumnDefinition Width="*" />
  420. <ColumnDefinition Width="30" />
  421. </Grid.ColumnDefinitions>
  422. <Border
  423. Grid.ColumnSpan="2"
  424. Background="White"
  425. Opacity="0" />
  426. <Path
  427. x:Name="Arrow"
  428. Grid.Column="1"
  429. HorizontalAlignment="Center"
  430. VerticalAlignment="Center"
  431. Data="M 0 0 6 6 12 0 Z"
  432. Fill="#FF2AB2E7"
  433. Stretch="None">
  434. <Path.Effect>
  435. <DropShadowEffect
  436. BlurRadius="10"
  437. Direction="90"
  438. Opacity="1"
  439. RenderingBias="Quality"
  440. ShadowDepth="0"
  441. Color="Transparent" />
  442. </Path.Effect>
  443. </Path>
  444. </Grid>
  445. <ControlTemplate.Triggers>
  446. <Trigger Property="IsChecked" Value="true">
  447. <Setter TargetName="Arrow" Property="RenderTransform">
  448. <Setter.Value>
  449. <RotateTransform Angle="180" CenterX="6" CenterY="3" />
  450. </Setter.Value>
  451. </Setter>
  452. <Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" />
  453. </Trigger>
  454. </ControlTemplate.Triggers>
  455. </ControlTemplate>
  456. <Style x:Key="CommonCombox" TargetType="{x:Type ComboBox}">
  457. <Setter Property="BorderThickness" Value="1" />
  458. <Setter Property="Background" Value=" #041039"/>
  459. <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
  460. <Setter Property="BorderThickness" Value="1"/>
  461. <Setter Property="ItemContainerStyle">
  462. <Setter.Value>
  463. <Style TargetType="ComboBoxItem">
  464. <Setter Property="Height" Value="25" />
  465. <Setter Property="Template">
  466. <Setter.Value>
  467. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  468. <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" >
  469. <Border x:Name="_borderbg" Background=" #041039" BorderBrush="#FF2AB2E7" BorderThickness="0"/>
  470. <TextBlock
  471. x:Name="_txt"
  472. Margin="5,0,3,0"
  473. HorizontalAlignment="Left"
  474. VerticalAlignment="Center"
  475. Foreground="#FF2AB2E7"
  476. Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
  477. <Border
  478. x:Name="_border"
  479. Background="Transparent"
  480. Opacity="0" />
  481. </Grid>
  482. <ControlTemplate.Triggers>
  483. <MultiTrigger>
  484. <MultiTrigger.Conditions>
  485. <Condition Property="IsSelected" Value="false" />
  486. <Condition Property="IsMouseOver" Value="true" />
  487. </MultiTrigger.Conditions>
  488. <Setter TargetName="_borderbg" Property="Background" Value="#37405E" />
  489. <Setter TargetName="_borderbg" Property="BorderBrush" Value="white" />
  490. <Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
  491. <Setter TargetName="_txt" Property="Foreground" Value="white" />
  492. </MultiTrigger>
  493. <MultiTrigger>
  494. <MultiTrigger.Conditions>
  495. <Condition Property="IsSelected" Value="true" />
  496. </MultiTrigger.Conditions>
  497. <Setter TargetName="_borderbg" Property="Background" Value="#022352" />
  498. <Setter TargetName="_borderbg" Property="BorderBrush" Value=" #00BFFF" />
  499. <Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
  500. <Setter TargetName="_txt" Property="Foreground" Value="white" />
  501. </MultiTrigger>
  502. </ControlTemplate.Triggers>
  503. </ControlTemplate>
  504. </Setter.Value>
  505. </Setter>
  506. </Style>
  507. </Setter.Value>
  508. </Setter>
  509. <Setter Property="Template">
  510. <Setter.Value>
  511. <ControlTemplate TargetType="{x:Type ComboBox}">
  512. <Grid>
  513. <Grid.ColumnDefinitions>
  514. <ColumnDefinition Width="0.7*" />
  515. <ColumnDefinition Width="0.3*" MaxWidth="30" />
  516. </Grid.ColumnDefinitions>
  517. <Border
  518. x:Name="_prybr"
  519. Grid.Column="0"
  520. Grid.ColumnSpan="2"
  521. BorderBrush="{TemplateBinding BorderBrush}"
  522. BorderThickness="{TemplateBinding BorderThickness}"
  523. CornerRadius="0" />
  524. <ContentPresenter
  525. x:Name="ContentSite"
  526. Margin="3,3,0,3"
  527. HorizontalAlignment="Center"
  528. VerticalAlignment="Center"
  529. Content="{TemplateBinding SelectionBoxItem}"
  530. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  531. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  532. IsHitTestVisible="False" />
  533. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  534. <ToggleButton
  535. Background="Transparent"
  536. x:Name="ToggleButton"
  537. Grid.Column="0"
  538. Grid.ColumnSpan="2"
  539. ClickMode="Press"
  540. Focusable="false"
  541. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  542. Template="{StaticResource ComboBoxToggleButton}" />
  543. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  544. <TextBox
  545. x:Name="PART_EditableTextBox"
  546. Margin="2,0,0,0"
  547. VerticalAlignment="Center"
  548. Background="Transparent"
  549. BorderThickness="0"
  550. CaretBrush="{TemplateBinding Foreground}"
  551. Focusable="True"
  552. Foreground="{TemplateBinding Foreground}"
  553. IsReadOnly="{TemplateBinding IsReadOnly}"
  554. Visibility="Hidden" />
  555. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  556. <Popup
  557. x:Name="Popup"
  558. AllowsTransparency="True"
  559. Focusable="False"
  560. IsOpen="{TemplateBinding IsDropDownOpen}"
  561. Placement="Bottom"
  562. PopupAnimation="Slide">
  563. <Grid
  564. x:Name="DropDown"
  565. MinWidth="{TemplateBinding ActualWidth}"
  566. MaxHeight="150"
  567. SnapsToDevicePixels="True">
  568. <Border
  569. x:Name="DropDownBorder"
  570. BorderBrush="Black"
  571. BorderThickness="0" />
  572. <ScrollViewer
  573. Margin="1"
  574. CanContentScroll="True"
  575. HorizontalScrollBarVisibility="Hidden"
  576. SnapsToDevicePixels="True"
  577. VerticalScrollBarVisibility="Auto"
  578. Template="{DynamicResource MyScrollViewer }">
  579. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  580. <!-- 一下可以设置列表背景色 -->
  581. <StackPanel
  582. Background="{TemplateBinding Background}"
  583. IsItemsHost="True"
  584. KeyboardNavigation.DirectionalNavigation="Contained"/>
  585. </ScrollViewer>
  586. </Grid>
  587. </Popup>
  588. </Grid>
  589. <ControlTemplate.Triggers>
  590. <Trigger Property="IsEditable" Value="true">
  591. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  592. </Trigger>
  593. <Trigger Property="IsMouseOver" Value="True">
  594. <Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" />
  595. </Trigger>
  596. <Trigger Property="IsEnabled" Value="False">
  597. <Setter TargetName="ContentSite" Property="Opacity" Value="0.6" />
  598. </Trigger>
  599. </ControlTemplate.Triggers>
  600. </ControlTemplate>
  601. </Setter.Value>
  602. </Setter>
  603. </Style>
  604. <!--滚动条颜色、圆角等设置-->
  605. <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  606. <Setter Property="OverridesDefaultStyle" Value="true"/>
  607. <Setter Property="Background" Value="Transparent"/>
  608. <Setter Property="Focusable" Value="false"/>
  609. <Setter Property="IsTabStop" Value="false"/>
  610. <Setter Property="Template">
  611. <Setter.Value>
  612. <ControlTemplate TargetType="{x:Type RepeatButton}">
  613. <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
  614. </ControlTemplate>
  615. </Setter.Value>
  616. </Setter>
  617. </Style>
  618. <Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}">
  619. <Setter Property="Background" Value="AliceBlue"/>
  620. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  621. <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
  622. <!--滚动条宽度-->
  623. <Setter Property="Width" Value="8"/>
  624. <Setter Property="MinWidth" Value="6"/>
  625. <Setter Property="Template">
  626. <Setter.Value>
  627. <ControlTemplate TargetType="{x:Type ScrollBar}">
  628. <!--滚动条背景色-->
  629. <Grid x:Name="Bg" Background="#001f55" SnapsToDevicePixels="true" Width="8">
  630. <Grid.RowDefinitions>
  631. <RowDefinition />
  632. </Grid.RowDefinitions>
  633. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  634. <Track.DecreaseRepeatButton>
  635. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  636. </Track.DecreaseRepeatButton>
  637. <Track.IncreaseRepeatButton>
  638. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
  639. </Track.IncreaseRepeatButton>
  640. <Track.Thumb>
  641. <Thumb Style="{StaticResource ScrollBarThumb}"/>
  642. </Track.Thumb>
  643. </Track>
  644. </Grid>
  645. <ControlTemplate.Triggers>
  646. <Trigger Property="IsEnabled" Value="false">
  647. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  648. </Trigger>
  649. </ControlTemplate.Triggers>
  650. </ControlTemplate>
  651. </Setter.Value>
  652. </Setter>
  653. <Style.Triggers>
  654. <Trigger Property="Orientation" Value="Horizontal">
  655. <Setter Property="Width" Value="Auto"/>
  656. <Setter Property="MinWidth" Value="0"/>
  657. <Setter Property="Height" Value="6"/>
  658. <Setter Property="MinHeight" Value="6"/>
  659. <Setter Property="Background" Value="AliceBlue"/>
  660. <Setter Property="Template">
  661. <Setter.Value>
  662. <ControlTemplate TargetType="{x:Type ScrollBar}">
  663. <Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true">
  664. <Grid.ColumnDefinitions>
  665. <ColumnDefinition />
  666. </Grid.ColumnDefinitions>
  667. <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
  668. <Track.DecreaseRepeatButton>
  669. <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  670. </Track.DecreaseRepeatButton>
  671. <Track.IncreaseRepeatButton>
  672. <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
  673. </Track.IncreaseRepeatButton>
  674. <Track.Thumb>
  675. <Thumb Style="{StaticResource ScrollBarThumb}" />
  676. </Track.Thumb>
  677. </Track>
  678. </Grid>
  679. <ControlTemplate.Triggers>
  680. <Trigger Property="IsEnabled" Value="false">
  681. <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
  682. </Trigger>
  683. </ControlTemplate.Triggers>
  684. </ControlTemplate>
  685. </Setter.Value>
  686. </Setter>
  687. </Trigger>
  688. </Style.Triggers>
  689. </Style>
  690. <!--#endregion-->
  691. <Style x:Key="CommonTextBox" TargetType="{x:Type TextBox}">
  692. <Setter Property="Foreground" Value="Orange"/>
  693. <Setter Property="Background" Value="Transparent"/>
  694. <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
  695. <Setter Property="VerticalContentAlignment" Value="Center"/>
  696. </Style>
  697. </Application.Resources>
  698. </Application>