ButtonStyle.xaml 103 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:button="clr-namespace:Muchinfo.WPF.Controls.Button;assembly=Muchinfo.WPF.Controls"
  4. xmlns:converters="clr-namespace:Muchinfo.MTPClient.Converters"
  5. xmlns:windows="clr-namespace:Muchinfo.WPF.Controls.Windows;assembly=Muchinfo.WPF.Controls"
  6. xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
  7. <Style x:Key="ButtonFocusVisual">
  8. <Setter Property="Control.Template">
  9. <Setter.Value>
  10. <ControlTemplate>
  11. <Border>
  12. <Rectangle Margin="4"
  13. SnapsToDevicePixels="true"
  14. Stroke="{DynamicResource MuchinfoBrush1}"
  15. StrokeDashArray="1 2"
  16. StrokeThickness="1" />
  17. </Border>
  18. </ControlTemplate>
  19. </Setter.Value>
  20. </Setter>
  21. </Style>
  22. <Style x:Key="CommonButtonStyle" TargetType="{x:Type Button}">
  23. <Setter Property="BorderThickness" Value="0" />
  24. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush66}" />
  25. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  26. <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}" />
  27. <Setter Property="HorizontalContentAlignment" Value="Center" />
  28. <Setter Property="VerticalContentAlignment" Value="Center" />
  29. <Setter Property="Padding" Value="20,5" />
  30. <Setter Property="Template">
  31. <Setter.Value>
  32. <ControlTemplate TargetType="{x:Type Button}">
  33. <Grid x:Name="MainGrid" SnapsToDevicePixels="True">
  34. <Border x:Name="OutsideBorder"
  35. Background="{TemplateBinding Background}"
  36. BorderBrush="{TemplateBinding BorderBrush}"
  37. BorderThickness="{TemplateBinding BorderThickness}"
  38. CornerRadius="0"
  39. Visibility="Collapsed" />
  40. <Border x:Name="InnerBorder"
  41. Background="{TemplateBinding Background}"
  42. BorderBrush="{TemplateBinding BorderBrush}"
  43. BorderThickness="{TemplateBinding BorderThickness}"
  44. CornerRadius="0"
  45. Visibility="Visible">
  46. <Grid>
  47. <Grid.ColumnDefinitions>
  48. <ColumnDefinition Width="*" />
  49. <ColumnDefinition Width="Auto" />
  50. </Grid.ColumnDefinitions>
  51. <ContentPresenter Margin="{TemplateBinding Padding}"
  52. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  53. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  54. Content="{TemplateBinding Content}"
  55. ContentTemplate="{TemplateBinding ContentTemplate}"
  56. RecognizesAccessKey="True" />
  57. </Grid>
  58. </Border>
  59. </Grid>
  60. <ControlTemplate.Triggers>
  61. <Trigger Property="IsEnabled" Value="False">
  62. <Setter TargetName="InnerBorder" Property="Background" Value="{DynamicResource MuchinfoBrush9}" />
  63. <Setter TargetName="OutsideBorder" Property="Background" Value="{DynamicResource MuchinfoBrush13}" />
  64. </Trigger>
  65. <Trigger Property="IsMouseOver" Value="True ">
  66. <Setter TargetName="OutsideBorder" Property="Visibility" Value="Visible" />
  67. <Setter TargetName="InnerBorder" Property="Background" Value="{DynamicResource MuchinfoBrush48}" />
  68. <Setter TargetName="OutsideBorder" Property="Background" Value="{DynamicResource MuchinfoBrush48}" />
  69. </Trigger>
  70. <Trigger Property="IsPressed" Value="True">
  71. <Setter TargetName="OutsideBorder" Property="Visibility" Value="Collapsed" />
  72. <Setter TargetName="MainGrid" Property="Margin" Value="1" />
  73. </Trigger>
  74. </ControlTemplate.Triggers>
  75. </ControlTemplate>
  76. </Setter.Value>
  77. </Setter>
  78. </Style>
  79. <Style x:Key="CheckContractsButtonStyle"
  80. BasedOn="{StaticResource CommonButtonStyle}"
  81. TargetType="Button">
  82. <Setter Property="Height" Value="32" />
  83. </Style>
  84. <Style x:Key="InvestmentProductButtonStyle"
  85. BasedOn="{StaticResource CommonButtonStyle}"
  86. TargetType="Button">
  87. <Setter Property="Height" Value="35" />
  88. </Style>
  89. <!-- 文本按钮 -->
  90. <Style x:Key="TextButtonStyle" TargetType="{x:Type Button}">
  91. <Setter Property="BorderThickness" Value="1" />
  92. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush12}" />
  93. <Setter Property="Background" Value="Transparent" />
  94. <Setter Property="HorizontalContentAlignment" Value="Center" />
  95. <Setter Property="VerticalContentAlignment" Value="Center" />
  96. <Setter Property="Padding" Value="20,5" />
  97. <Setter Property="Template">
  98. <Setter.Value>
  99. <ControlTemplate TargetType="{x:Type Button}">
  100. <Grid x:Name="MainGrid" SnapsToDevicePixels="True">
  101. <ContentPresenter Margin="{TemplateBinding Padding}"
  102. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  103. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  104. Content="{TemplateBinding Content}"
  105. ContentTemplate="{TemplateBinding ContentTemplate}"
  106. RecognizesAccessKey="True" />
  107. <Border x:Name="linkLine"
  108. Grid.ColumnSpan="2"
  109. Height="1 "
  110. VerticalAlignment="Bottom"
  111. BorderBrush="{TemplateBinding Foreground}"
  112. BorderThickness="1"
  113. Visibility="Collapsed" />
  114. </Grid>
  115. <ControlTemplate.Triggers>
  116. <Trigger Property="IsEnabled" Value="False" />
  117. <Trigger Property="IsMouseOver" Value="True">
  118. <Setter TargetName="linkLine" Property="Visibility" Value="Visible" />
  119. </Trigger>
  120. <Trigger Property="IsPressed" Value="True">
  121. <Setter TargetName="MainGrid" Property="Margin" Value="1" />
  122. </Trigger>
  123. </ControlTemplate.Triggers>
  124. </ControlTemplate>
  125. </Setter.Value>
  126. </Setter>
  127. </Style>
  128. <!-- 窗口最大化按钮样式 -->
  129. <Style x:Key="DialogMaxButtonStyle" TargetType="{x:Type Button}">
  130. <Setter Property="BorderThickness" Value="0" />
  131. <Setter Property="Height" Value="20" />
  132. <Setter Property="Width" Value="20" />
  133. <Setter Property="HorizontalContentAlignment" Value="Center" />
  134. <Setter Property="VerticalContentAlignment" Value="Center" />
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="{x:Type Button}">
  138. <Border x:Name="ContentContainer" CornerRadius="2">
  139. <Image x:Name="image"
  140. Source="{DynamicResource DialogWindowmax}"
  141. Stretch="Uniform" />
  142. </Border>
  143. <ControlTemplate.Triggers>
  144. <Trigger Property="IsPressed" Value="true">
  145. <Setter TargetName="image" Property="Source" Value="{DynamicResource DialogWindowmax}" />
  146. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  147. </Trigger>
  148. <Trigger Property="IsMouseOver" Value="True">
  149. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  150. </Trigger>
  151. </ControlTemplate.Triggers>
  152. </ControlTemplate>
  153. </Setter.Value>
  154. </Setter>
  155. </Style>
  156. <!-- 窗口最大化按钮样式 -->
  157. <Style x:Key="DialogMaxButtonStyle1" TargetType="{x:Type Button}">
  158. <Setter Property="BorderThickness" Value="0" />
  159. <Setter Property="Height" Value="20" />
  160. <Setter Property="Width" Value="20" />
  161. <Setter Property="HorizontalContentAlignment" Value="Center" />
  162. <Setter Property="VerticalContentAlignment" Value="Center" />
  163. <Setter Property="Template">
  164. <Setter.Value>
  165. <ControlTemplate TargetType="{x:Type Button}">
  166. <Border x:Name="ContentContainer" CornerRadius="2">
  167. <Image x:Name="image"
  168. Source="{DynamicResource DialogWindowmax1}"
  169. Stretch="Uniform" />
  170. </Border>
  171. <ControlTemplate.Triggers>
  172. <Trigger Property="IsPressed" Value="true">
  173. <Setter TargetName="image" Property="Source" Value="{DynamicResource DialogWindowmax1}" />
  174. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  175. </Trigger>
  176. <Trigger Property="IsMouseOver" Value="True">
  177. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  178. </Trigger>
  179. </ControlTemplate.Triggers>
  180. </ControlTemplate>
  181. </Setter.Value>
  182. </Setter>
  183. </Style>
  184. <!--
  185. Simple ScrollViewer
  186. ScrollViewer 是 Grid 控件,该控件包含 ContentPresenter 以及 Horizontal 和 Vertical ScrollBar
  187. 它可供 ListBox、MenuItem、ComboBox 和 TreeView 使用
  188. -->
  189. <Style x:Key="SimpleScrollViewer"
  190. BasedOn="{x:Null}"
  191. TargetType="{x:Type ScrollViewer}">
  192. <Setter Property="Template">
  193. <Setter.Value>
  194. <ControlTemplate TargetType="{x:Type ScrollViewer}">
  195. <Grid Background="{TemplateBinding Background}">
  196. <Grid.ColumnDefinitions>
  197. <ColumnDefinition Width="*" />
  198. <ColumnDefinition Width="Auto" />
  199. </Grid.ColumnDefinitions>
  200. <Grid.RowDefinitions>
  201. <RowDefinition Height="*" />
  202. <RowDefinition Height="Auto" />
  203. </Grid.RowDefinitions>
  204. <ScrollContentPresenter Grid.Row="0"
  205. Grid.Column="0"
  206. Margin="{TemplateBinding Padding}"
  207. CanContentScroll="{TemplateBinding CanContentScroll}"
  208. Content="{TemplateBinding Content}"
  209. ContentTemplate="{TemplateBinding ContentTemplate}" />
  210. <!-- ScrollBars 的可见性通过控件的实现来控制 -->
  211. <ScrollBar x:Name="PART_HorizontalScrollBar"
  212. Grid.Row="1"
  213. Grid.Column="0"
  214. Maximum="{TemplateBinding ScrollableWidth}"
  215. Minimum="0"
  216. Orientation="Horizontal"
  217. Style="{DynamicResource SimpleScrollBar}"
  218. ViewportSize="{TemplateBinding ViewportWidth}"
  219. Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
  220. Value="{Binding HorizontalOffset,
  221. Mode=OneWay,
  222. RelativeSource={RelativeSource TemplatedParent}}" />
  223. <ScrollBar x:Name="PART_VerticalScrollBar"
  224. Grid.Row="0"
  225. Grid.Column="1"
  226. Maximum="{TemplateBinding ScrollableHeight}"
  227. Minimum="0"
  228. Orientation="Vertical"
  229. Style="{DynamicResource SimpleScrollBar}"
  230. ViewportSize="{TemplateBinding ViewportHeight}"
  231. Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  232. Value="{Binding VerticalOffset,
  233. Mode=OneWay,
  234. RelativeSource={RelativeSource TemplatedParent}}" />
  235. </Grid>
  236. </ControlTemplate>
  237. </Setter.Value>
  238. </Setter>
  239. </Style>
  240. <Style x:Key="ComboBoxToggleButton"
  241. BasedOn="{x:Null}"
  242. TargetType="{x:Type ToggleButton}">
  243. <Setter Property="Template">
  244. <Setter.Value>
  245. <ControlTemplate TargetType="{x:Type ToggleButton}">
  246. <Grid>
  247. <Grid.ColumnDefinitions>
  248. <ColumnDefinition />
  249. <ColumnDefinition Width="20" />
  250. </Grid.ColumnDefinitions>
  251. <Border x:Name="Rectangle"
  252. Grid.ColumnSpan="2"
  253. Width="Auto"
  254. Height="Auto"
  255. HorizontalAlignment="Stretch"
  256. VerticalAlignment="Stretch"
  257. Background="{DynamicResource MuchinfoBrush7}"
  258. BorderBrush="{TemplateBinding BorderBrush}"
  259. BorderThickness="{TemplateBinding BorderThickness}" />
  260. <Border Grid.Column="0"
  261. Width="Auto"
  262. Height="Auto"
  263. HorizontalAlignment="Stretch"
  264. VerticalAlignment="Stretch"
  265. Background="{TemplateBinding Background}"
  266. BorderBrush="{TemplateBinding BorderBrush}"
  267. BorderThickness="{TemplateBinding BorderThickness}" />
  268. <Path x:Name="Arrow"
  269. Grid.Column="1"
  270. Width="12"
  271. Height="8"
  272. HorizontalAlignment="Center"
  273. VerticalAlignment="Center"
  274. Data="M107.45833,12.625 L115.042,22.375 122.34343,12.46875"
  275. Stretch="Fill"
  276. Stroke="{DynamicResource MuchinfoBrush10}"
  277. StrokeThickness="1" />
  278. </Grid>
  279. <ControlTemplate.Triggers>
  280. <Trigger Property="IsChecked" Value="true">
  281. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource MuchinfoBrush40}" />
  282. </Trigger>
  283. <Trigger Property="IsMouseOver" Value="true">
  284. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource MuchinfoBrush40}" />
  285. </Trigger>
  286. <Trigger Property="IsEnabled" Value="False">
  287. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" />
  288. <Setter TargetName="Rectangle" Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" />
  289. </Trigger>
  290. </ControlTemplate.Triggers>
  291. </ControlTemplate>
  292. </Setter.Value>
  293. </Setter>
  294. </Style>
  295. <Style x:Key="AccountComboBoxToggleButton"
  296. BasedOn="{x:Null}"
  297. TargetType="{x:Type ToggleButton}">
  298. <Setter Property="Height" Value="24" />
  299. <Setter Property="Template">
  300. <Setter.Value>
  301. <ControlTemplate TargetType="{x:Type ToggleButton}">
  302. <Grid>
  303. <Grid.ColumnDefinitions>
  304. <ColumnDefinition />
  305. <ColumnDefinition Width="20" />
  306. </Grid.ColumnDefinitions>
  307. <Border x:Name="Rectangle"
  308. Grid.ColumnSpan="2"
  309. Width="Auto"
  310. Height="Auto"
  311. HorizontalAlignment="Stretch"
  312. VerticalAlignment="Stretch"
  313. Background="{DynamicResource MuchinfoBrush4}"
  314. BorderBrush="{TemplateBinding BorderBrush}"
  315. BorderThickness="{TemplateBinding BorderThickness}" />
  316. <Border Grid.Column="0"
  317. Width="Auto"
  318. Height="Auto"
  319. HorizontalAlignment="Stretch"
  320. VerticalAlignment="Stretch"
  321. Background="{TemplateBinding Background}"
  322. BorderBrush="{TemplateBinding BorderBrush}"
  323. BorderThickness="{TemplateBinding BorderThickness}" />
  324. <Path x:Name="Arrow"
  325. Grid.Column="1"
  326. Width="12"
  327. Height="8"
  328. HorizontalAlignment="Center"
  329. VerticalAlignment="Center"
  330. Data="M107.45833,12.625 L115.042,22.375 122.34343,12.46875"
  331. Stretch="Fill"
  332. Stroke="{DynamicResource MuchinfoBrush10}"
  333. StrokeThickness="1" />
  334. </Grid>
  335. <ControlTemplate.Triggers>
  336. <Trigger Property="IsChecked" Value="true">
  337. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource MuchinfoBrush40}" />
  338. </Trigger>
  339. <Trigger Property="IsMouseOver" Value="true">
  340. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource MuchinfoBrush40}" />
  341. </Trigger>
  342. <Trigger Property="IsEnabled" Value="False">
  343. <Setter TargetName="Rectangle" Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" />
  344. <Setter TargetName="Rectangle" Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" />
  345. </Trigger>
  346. </ControlTemplate.Triggers>
  347. </ControlTemplate>
  348. </Setter.Value>
  349. </Setter>
  350. </Style>
  351. <!-- 这是包含 ComboBox 中的选定项的区域 -->
  352. <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
  353. <!-- 必须将其命名为 PART_ContentHost -->
  354. <Border x:Name="PART_ContentHost"
  355. Background="{TemplateBinding Background}"
  356. Focusable="False" />
  357. </ControlTemplate>
  358. <!-- Simple ComboBoxItem - 它用于 ComboBox 中的每个项。可以更改下面每个项的选定颜色 -->
  359. <Style TargetType="{x:Type ComboBoxItem}">
  360. <Setter Property="SnapsToDevicePixels" Value="true" />
  361. <Setter Property="Template">
  362. <Setter.Value>
  363. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  364. <Grid SnapsToDevicePixels="true">
  365. <Border x:Name="Border"
  366. Background="{TemplateBinding Background}"
  367. BorderBrush="{TemplateBinding BorderBrush}"
  368. BorderThickness="{TemplateBinding BorderThickness}" />
  369. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  370. </Grid>
  371. <ControlTemplate.Triggers>
  372. <!-- 更改 IsHighlighted SelectedBackgroundBrush,以设置各项的选择颜色 -->
  373. <Trigger Property="IsHighlighted" Value="true">
  374. <Setter TargetName="Border" Property="Background" Value="{DynamicResource MuchinfoBrush49}" />
  375. </Trigger>
  376. <!-- SelectedBackgroundBrush -->
  377. <Trigger Property="IsEnabled" Value="false">
  378. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" />
  379. </Trigger>
  380. </ControlTemplate.Triggers>
  381. </ControlTemplate>
  382. </Setter.Value>
  383. </Setter>
  384. </Style>
  385. <!--
  386. Simple ComboBox
  387. 它使用 ComboBoxToggleButton 来展开和折叠 Popup 控件
  388. 使用 SimpleScrollViewer 可使项滚动,而使用 SimpleComboBoxItem 可定义每个项的外观
  389. Popup 显示了 StackPanel 中的项的列表
  390. -->
  391. <Style x:Key="BaseComboxStyle" TargetType="{x:Type ComboBox}">
  392. <Setter Property="Height" Value="24" />
  393. <Setter Property="SnapsToDevicePixels" Value="true" />
  394. <Setter Property="Template">
  395. <Setter.Value>
  396. <ControlTemplate TargetType="{x:Type ComboBox}">
  397. <Grid>
  398. <Grid.ColumnDefinitions>
  399. <ColumnDefinition />
  400. <ColumnDefinition Width="20" />
  401. </Grid.ColumnDefinitions>
  402. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  403. <ToggleButton x:Name="ToggleButton"
  404. Grid.ColumnSpan="2"
  405. Background="{TemplateBinding Background}"
  406. BorderBrush="{TemplateBinding BorderBrush}"
  407. BorderThickness="{TemplateBinding BorderThickness}"
  408. ClickMode="Press"
  409. Focusable="false"
  410. IsChecked="{Binding IsDropDownOpen,
  411. Mode=TwoWay,
  412. RelativeSource={RelativeSource TemplatedParent}}"
  413. Style="{DynamicResource ComboBoxToggleButton}" />
  414. <ContentPresenter x:Name="ContentSite"
  415. Margin="3,0,3,0"
  416. VerticalAlignment="Center"
  417. Content="{TemplateBinding SelectionBoxItem}"
  418. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  419. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  420. IsHitTestVisible="False" />
  421. <Rectangle x:Name="enableRectangle"
  422. Grid.ColumnSpan="2"
  423. Fill="{DynamicResource MuchinfoBrush7}"
  424. Opacity="0.7"
  425. Visibility="Collapsed" />
  426. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  427. <TextBox x:Name="PART_EditableTextBox"
  428. Margin="3"
  429. VerticalAlignment="Stretch"
  430. Background="Transparent"
  431. BorderThickness="0"
  432. Focusable="True"
  433. IsReadOnly="{TemplateBinding IsReadOnly}"
  434. Visibility="Hidden" />
  435. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  436. <Popup x:Name="Popup"
  437. AllowsTransparency="True"
  438. Focusable="False"
  439. IsOpen="{TemplateBinding IsDropDownOpen}"
  440. Placement="Bottom"
  441. PopupAnimation="Fade">
  442. <Grid x:Name="DropDown"
  443. MinWidth="{TemplateBinding ActualWidth}"
  444. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  445. SnapsToDevicePixels="True">
  446. <Border x:Name="DropDownBorder"
  447. Background="{DynamicResource MuchinfoBrush1}"
  448. BorderBrush="{TemplateBinding BorderBrush}"
  449. BorderThickness="1" />
  450. <ScrollViewer Margin="4,2,4,6"
  451. CanContentScroll="True"
  452. HorizontalScrollBarVisibility="Auto"
  453. SnapsToDevicePixels="True"
  454. Style="{DynamicResource SimpleScrollViewer}"
  455. VerticalScrollBarVisibility="Auto">
  456. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  457. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
  458. </ScrollViewer>
  459. </Grid>
  460. </Popup>
  461. </Grid>
  462. <ControlTemplate.Triggers>
  463. <!-- 这会强制 DropDown 的大小有最小限制(如果它为空) -->
  464. <Trigger Property="HasItems" Value="false">
  465. <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
  466. </Trigger>
  467. <Trigger Property="IsEnabled" Value="false">
  468. <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
  469. </Trigger>
  470. <Trigger Property="IsGrouping" Value="true">
  471. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  472. </Trigger>
  473. <Trigger SourceName="Popup" Property="AllowsTransparency" Value="true">
  474. <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4" />
  475. <Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0" />
  476. </Trigger>
  477. <Trigger Property="IsEditable" Value="true">
  478. <Setter Property="IsTabStop" Value="false" />
  479. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  480. <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden" />
  481. </Trigger>
  482. </ControlTemplate.Triggers>
  483. </ControlTemplate>
  484. </Setter.Value>
  485. </Setter>
  486. </Style>
  487. <Style x:Key="LoginComboxStyle" TargetType="{x:Type ComboBox}">
  488. <Setter Property="Height" Value="24" />
  489. <Setter Property="SnapsToDevicePixels" Value="true" />
  490. <Setter Property="Template">
  491. <Setter.Value>
  492. <ControlTemplate TargetType="{x:Type ComboBox}">
  493. <Grid>
  494. <Grid.ColumnDefinitions>
  495. <ColumnDefinition />
  496. <ColumnDefinition Width="20" />
  497. </Grid.ColumnDefinitions>
  498. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  499. <ToggleButton x:Name="ToggleButton"
  500. Grid.ColumnSpan="2"
  501. Background="{TemplateBinding Background}"
  502. BorderBrush="{TemplateBinding BorderBrush}"
  503. BorderThickness="{TemplateBinding BorderThickness}"
  504. ClickMode="Press"
  505. Focusable="false"
  506. IsChecked="{Binding IsDropDownOpen,
  507. Mode=TwoWay,
  508. RelativeSource={RelativeSource TemplatedParent}}"
  509. Style="{DynamicResource ComboBoxToggleButton}" />
  510. <ContentPresenter x:Name="ContentSite"
  511. Margin="3,0,3,0"
  512. VerticalAlignment="Center"
  513. Content="{TemplateBinding SelectionBoxItem}"
  514. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  515. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  516. IsHitTestVisible="False" />
  517. <Rectangle x:Name="enableRectangle"
  518. Grid.ColumnSpan="2"
  519. Fill="{DynamicResource MuchinfoBrush64}"
  520. Opacity="0.7"
  521. Visibility="Collapsed" />
  522. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  523. <TextBox x:Name="PART_EditableTextBox"
  524. Margin="3"
  525. VerticalAlignment="Stretch"
  526. Background="Transparent"
  527. BorderThickness="0"
  528. Focusable="True"
  529. IsReadOnly="{TemplateBinding IsReadOnly}"
  530. Visibility="Hidden" />
  531. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  532. <Popup x:Name="Popup"
  533. AllowsTransparency="True"
  534. Focusable="False"
  535. IsOpen="{TemplateBinding IsDropDownOpen}"
  536. Placement="Bottom"
  537. PopupAnimation="Fade">
  538. <Grid x:Name="DropDown"
  539. MinWidth="{TemplateBinding ActualWidth}"
  540. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  541. SnapsToDevicePixels="True">
  542. <Border x:Name="DropDownBorder"
  543. Background="{TemplateBinding Background}"
  544. BorderBrush="{TemplateBinding BorderBrush}"
  545. BorderThickness="1" />
  546. <ScrollViewer Margin="4,2,4,6"
  547. CanContentScroll="True"
  548. HorizontalScrollBarVisibility="Auto"
  549. SnapsToDevicePixels="True"
  550. Style="{DynamicResource SimpleScrollViewer}"
  551. VerticalScrollBarVisibility="Auto">
  552. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  553. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
  554. </ScrollViewer>
  555. </Grid>
  556. </Popup>
  557. </Grid>
  558. <ControlTemplate.Triggers>
  559. <!-- 这会强制 DropDown 的大小有最小限制(如果它为空) -->
  560. <Trigger Property="HasItems" Value="false">
  561. <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
  562. </Trigger>
  563. <Trigger Property="IsEnabled" Value="false">
  564. <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
  565. </Trigger>
  566. <Trigger Property="IsGrouping" Value="true">
  567. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  568. </Trigger>
  569. <Trigger SourceName="Popup" Property="AllowsTransparency" Value="true">
  570. <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4" />
  571. <Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0" />
  572. </Trigger>
  573. <Trigger Property="IsEditable" Value="true">
  574. <Setter Property="IsTabStop" Value="false" />
  575. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  576. <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden" />
  577. </Trigger>
  578. </ControlTemplate.Triggers>
  579. </ControlTemplate>
  580. </Setter.Value>
  581. </Setter>
  582. </Style>
  583. <Style x:Key="AccountComboBoxStyle" TargetType="{x:Type ComboBox}">
  584. <Setter Property="BorderThickness" Value="1" />
  585. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush4}" />
  586. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush7}" />
  587. <Setter Property="SnapsToDevicePixels" Value="true" />
  588. <Setter Property="Template">
  589. <Setter.Value>
  590. <ControlTemplate TargetType="{x:Type ComboBox}">
  591. <Grid>
  592. <Grid.ColumnDefinitions>
  593. <ColumnDefinition />
  594. <ColumnDefinition Width="20" />
  595. </Grid.ColumnDefinitions>
  596. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  597. <ToggleButton x:Name="ToggleButton"
  598. Grid.ColumnSpan="2"
  599. Background="{TemplateBinding Background}"
  600. BorderBrush="{TemplateBinding BorderBrush}"
  601. BorderThickness="{TemplateBinding BorderThickness}"
  602. ClickMode="Press"
  603. Focusable="false"
  604. IsChecked="{Binding IsDropDownOpen,
  605. Mode=TwoWay,
  606. RelativeSource={RelativeSource TemplatedParent}}"
  607. Style="{DynamicResource AccountComboBoxToggleButton}" />
  608. <ContentPresenter x:Name="ContentSite"
  609. Margin="3"
  610. HorizontalAlignment="Left"
  611. VerticalAlignment="Center"
  612. Content="{TemplateBinding SelectionBoxItem}"
  613. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  614. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  615. IsHitTestVisible="False" />
  616. <Rectangle x:Name="enableRectangle"
  617. Grid.ColumnSpan="2"
  618. Fill="{DynamicResource MuchinfoBrush15}"
  619. Opacity="0.7"
  620. Visibility="Collapsed" />
  621. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  622. <TextBox x:Name="PART_EditableTextBox"
  623. Margin="3"
  624. HorizontalAlignment="Left"
  625. VerticalAlignment="Center"
  626. Background="Transparent"
  627. BorderThickness="0"
  628. Focusable="True"
  629. IsReadOnly="{TemplateBinding IsReadOnly}"
  630. Visibility="Hidden" />
  631. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  632. <Popup x:Name="Popup"
  633. AllowsTransparency="True"
  634. Focusable="False"
  635. IsOpen="{TemplateBinding IsDropDownOpen}"
  636. Placement="Bottom"
  637. PopupAnimation="Fade">
  638. <Grid x:Name="DropDown"
  639. MinWidth="{TemplateBinding ActualWidth}"
  640. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  641. SnapsToDevicePixels="True">
  642. <Border x:Name="DropDownBorder"
  643. Background="{TemplateBinding Background}"
  644. BorderBrush="{TemplateBinding BorderBrush}"
  645. BorderThickness="1" />
  646. <ScrollViewer Margin="4,2,4,6"
  647. CanContentScroll="True"
  648. HorizontalScrollBarVisibility="Auto"
  649. SnapsToDevicePixels="True"
  650. Style="{DynamicResource SimpleScrollViewer}"
  651. VerticalScrollBarVisibility="Auto">
  652. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  653. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
  654. </ScrollViewer>
  655. </Grid>
  656. </Popup>
  657. </Grid>
  658. <ControlTemplate.Triggers>
  659. <!-- 这会强制 DropDown 的大小有最小限制(如果它为空) -->
  660. <Trigger Property="HasItems" Value="false">
  661. <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
  662. </Trigger>
  663. <Trigger Property="IsEnabled" Value="false">
  664. <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
  665. </Trigger>
  666. <Trigger Property="IsGrouping" Value="true">
  667. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  668. </Trigger>
  669. <Trigger SourceName="Popup" Property="AllowsTransparency" Value="true">
  670. <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="4" />
  671. <Setter TargetName="DropDownBorder" Property="Margin" Value="0,2,0,0" />
  672. </Trigger>
  673. <Trigger Property="IsEditable" Value="true">
  674. <Setter Property="IsTabStop" Value="false" />
  675. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  676. <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden" />
  677. </Trigger>
  678. </ControlTemplate.Triggers>
  679. </ControlTemplate>
  680. </Setter.Value>
  681. </Setter>
  682. </Style>
  683. <Style x:Key="TopToggleButtonStyel" TargetType="{x:Type ToggleButton}">
  684. <Setter Property="Focusable" Value="False" />
  685. <Setter Property="Template">
  686. <Setter.Value>
  687. <ControlTemplate TargetType="{x:Type ToggleButton}">
  688. <Grid Margin="0,0,0,2" HorizontalAlignment="Left">
  689. <Path x:Name="rec"
  690. Data="M0.25,0.063333333 L0,47.063667 10,47.063667 19,38.56394 19.25,-0.18633511 z"
  691. Fill="{DynamicResource MuchinfoBrush4}"
  692. Stretch="Fill" />
  693. <TextBlock Width="{TemplateBinding Width}"
  694. HorizontalAlignment="Center"
  695. VerticalAlignment="Top"
  696. Foreground="{DynamicResource MuchinfoBrush11}"
  697. Padding="0,3,0,3"
  698. Text="{TemplateBinding Content}"
  699. TextWrapping="Wrap" />
  700. </Grid>
  701. <ControlTemplate.Triggers>
  702. <Trigger Property="IsMouseOver" Value="true">
  703. <Setter Property="Cursor" Value="Hand" />
  704. <Setter TargetName="rec" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  705. </Trigger>
  706. <Trigger Property="IsChecked" Value="true">
  707. <Setter TargetName="rec" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  708. </Trigger>
  709. <Trigger Property="IsEnabled" Value="False">
  710. <Setter TargetName="rec" Property="Fill" Value="{DynamicResource MuchinfoBrush25}" />
  711. </Trigger>
  712. </ControlTemplate.Triggers>
  713. </ControlTemplate>
  714. </Setter.Value>
  715. </Setter>
  716. </Style>
  717. <Style x:Key="CommonRadioButtonStyle" TargetType="{x:Type RadioButton}">
  718. <Setter Property="SnapsToDevicePixels" Value="true" />
  719. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush13}" />
  720. <Setter Property="Background" Value="Transparent" />
  721. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush13}" />
  722. <Setter Property="Padding" Value="5,0" />
  723. <Setter Property="Template">
  724. <Setter.Value>
  725. <ControlTemplate TargetType="{x:Type RadioButton}">
  726. <!-- BulletDecorator 用于提供 checkmark 与 Content 之间的基线对齐 -->
  727. <StackPanel Background="{TemplateBinding Background}" Orientation="Horizontal">
  728. <Grid Width="13" Height="13">
  729. <Ellipse x:Name="Ellipse_Border"
  730. Stroke="{TemplateBinding BorderBrush}"
  731. StrokeThickness="1" />
  732. <Ellipse x:Name="CheckMark"
  733. Margin="4"
  734. Fill="{TemplateBinding BorderBrush}" />
  735. </Grid>
  736. <ContentPresenter Margin="{TemplateBinding Padding}"
  737. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  738. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  739. RecognizesAccessKey="True" />
  740. </StackPanel>
  741. <ControlTemplate.Triggers>
  742. <Trigger Property="IsChecked" Value="false">
  743. <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed" />
  744. </Trigger>
  745. <Trigger Property="IsMouseOver" Value="true">
  746. <Setter TargetName="Ellipse_Border" Property="Fill" Value="{DynamicResource MouseOverBrush}" />
  747. </Trigger>
  748. <Trigger Property="IsPressed" Value="true">
  749. <Setter TargetName="Ellipse_Border" Property="Fill" Value="{DynamicResource PressedBrush}" />
  750. <Setter TargetName="Ellipse_Border" Property="Stroke" Value="{DynamicResource GlyphBrush}" />
  751. </Trigger>
  752. <Trigger Property="IsEnabled" Value="false" />
  753. </ControlTemplate.Triggers>
  754. </ControlTemplate>
  755. </Setter.Value>
  756. </Setter>
  757. </Style>
  758. <Style x:Key="CommonCheckBoxStyle" TargetType="{x:Type CheckBox}">
  759. <Setter Property="SnapsToDevicePixels" Value="true" />
  760. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush10}" />
  761. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  762. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush22}" />
  763. <Setter Property="Padding" Value="6,0,0,0" />
  764. <Setter Property="Template">
  765. <Setter.Value>
  766. <ControlTemplate TargetType="{x:Type CheckBox}">
  767. <!--
  768. BulletDecorator 用于提供 checkma
  769. rk 与 Content 之间的基线对齐
  770. -->
  771. <BulletDecorator Background="Transparent">
  772. <BulletDecorator.Bullet>
  773. <Grid Width="13" Height="13">
  774. <Border x:Name="Border"
  775. Background="{TemplateBinding Background}"
  776. BorderBrush="{TemplateBinding BorderBrush}"
  777. BorderThickness="{TemplateBinding BorderThickness}" />
  778. <Path x:Name="CheckMark"
  779. Data="M1.5,5.7816667 C2.125,6.1566667 5.75,10.906333 5.75,10.906333 L12.5,0.78165909"
  780. SnapsToDevicePixels="False"
  781. Stroke="{DynamicResource MuchinfoBrush10}"
  782. StrokeThickness="2" />
  783. </Grid>
  784. </BulletDecorator.Bullet>
  785. <ContentPresenter Margin="{TemplateBinding Padding}"
  786. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  787. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  788. RecognizesAccessKey="True" />
  789. </BulletDecorator>
  790. <!-- 它使用 Visibility 来基于 IsChecked 隐藏和显示 CheckMark -->
  791. <ControlTemplate.Triggers>
  792. <Trigger Property="IsChecked" Value="false">
  793. <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed" />
  794. </Trigger>
  795. <Trigger Property="IsMouseOver" Value="true">
  796. <Setter TargetName="Border" Property="Background" Value="{DynamicResource MouseOverBrush}" />
  797. </Trigger>
  798. <Trigger Property="IsPressed" Value="true">
  799. <Setter TargetName="Border" Property="Background" Value="{DynamicResource PressedBrush}" />
  800. <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" />
  801. </Trigger>
  802. <Trigger Property="IsEnabled" Value="false" />
  803. </ControlTemplate.Triggers>
  804. </ControlTemplate>
  805. </Setter.Value>
  806. </Setter>
  807. </Style>
  808. <Style x:Key="LeftToggleButtonStyelFinacing" TargetType="{x:Type ToggleButton}">
  809. <Setter Property="Focusable" Value="False" />
  810. <Setter Property="Template">
  811. <Setter.Value>
  812. <ControlTemplate TargetType="{x:Type ToggleButton}">
  813. <WrapPanel Width="{TemplateBinding Width}"
  814. Height="18"
  815. MinWidth="{TemplateBinding MinWidth}"
  816. Margin="0,0,0,0"
  817. HorizontalAlignment="Left">
  818. <Path x:Name="rec1"
  819. Data="M 5,0 L 18,5 L 18,0"
  820. Fill="{DynamicResource MuchinfoBrush5}"
  821. Stretch="Fill" />
  822. <StackPanel x:Name="stack1"
  823. Background="{DynamicResource MuchinfoBrush5}"
  824. Orientation="Horizontal">
  825. <TextBlock x:Name="txt"
  826. Margin="5,0"
  827. HorizontalAlignment="Center"
  828. VerticalAlignment="Center"
  829. Foreground="{DynamicResource MuchinfoBrush14}"
  830. Text="{TemplateBinding Content}" />
  831. </StackPanel>
  832. <Path x:Name="rec2"
  833. Data="M 0,0 L 5,18 L 0,18"
  834. Fill="{DynamicResource MuchinfoBrush5}"
  835. Stretch="Fill" />
  836. </WrapPanel>
  837. <ControlTemplate.Triggers>
  838. <Trigger Property="IsMouseOver" Value="true">
  839. <Setter Property="Cursor" Value="Hand" />
  840. <Setter TargetName="rec1" Property="Fill" Value="{DynamicResource MuchinfoBrush13}" />
  841. <Setter TargetName="rec2" Property="Fill" Value="{DynamicResource MuchinfoBrush13}" />
  842. <Setter TargetName="stack1" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  843. </Trigger>
  844. <Trigger Property="IsChecked" Value="true">
  845. <Setter TargetName="rec1" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  846. <Setter TargetName="rec2" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  847. <Setter TargetName="txt" Property="Foreground" Value="{DynamicResource MuchinfoBrush2}" />
  848. <Setter TargetName="stack1" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  849. </Trigger>
  850. </ControlTemplate.Triggers>
  851. </ControlTemplate>
  852. </Setter.Value>
  853. </Setter>
  854. </Style>
  855. <Style x:Key="LeftToggleButtonStyel" TargetType="{x:Type ToggleButton}">
  856. <Setter Property="Focusable" Value="False" />
  857. <Setter Property="Template">
  858. <Setter.Value>
  859. <ControlTemplate TargetType="{x:Type ToggleButton}">
  860. <Grid Width="{TemplateBinding Width}"
  861. Height="18"
  862. MinWidth="{TemplateBinding MinWidth}"
  863. Margin="0,0,0,0"
  864. HorizontalAlignment="Left">
  865. <Grid.ColumnDefinitions>
  866. <ColumnDefinition Width="7" />
  867. <ColumnDefinition Width="*" />
  868. <ColumnDefinition Width="3" />
  869. </Grid.ColumnDefinitions>
  870. <Path x:Name="rec1"
  871. Grid.Column="0"
  872. Data="M 0,0 L 18,7 L 18,0"
  873. Fill="{DynamicResource MuchinfoBrush5}"
  874. Stretch="Fill" />
  875. <StackPanel x:Name="stack1"
  876. Grid.Column="1"
  877. Background="{DynamicResource MuchinfoBrush5}"
  878. Orientation="Horizontal">
  879. <TextBlock x:Name="txt"
  880. Margin="5,0"
  881. HorizontalAlignment="Center"
  882. VerticalAlignment="Center"
  883. Foreground="{DynamicResource MuchinfoBrush12}"
  884. Text="{TemplateBinding Content}" />
  885. </StackPanel>
  886. <Path x:Name="rec2"
  887. Grid.Column="2"
  888. Data="M 0,0 L 3,7 L 0,18"
  889. Fill="{DynamicResource MuchinfoBrush5}"
  890. Stretch="Fill" />
  891. </Grid>
  892. <ControlTemplate.Triggers>
  893. <Trigger Property="IsMouseOver" Value="true">
  894. <Setter Property="Cursor" Value="Hand" />
  895. <Setter TargetName="rec1" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  896. <Setter TargetName="rec2" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  897. <Setter TargetName="stack1" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  898. </Trigger>
  899. <Trigger Property="IsChecked" Value="true">
  900. <Setter TargetName="rec1" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  901. <Setter TargetName="rec2" Property="Fill" Value="{DynamicResource MuchinfoBrush3}" />
  902. <Setter TargetName="txt" Property="Foreground" Value="{DynamicResource MuchinfoBrush5}" />
  903. <Setter TargetName="stack1" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  904. </Trigger>
  905. </ControlTemplate.Triggers>
  906. </ControlTemplate>
  907. </Setter.Value>
  908. </Setter>
  909. </Style>
  910. <!-- 主页隐藏与展开按键 -->
  911. <Style x:Key="HideImageButtonStyle" TargetType="{x:Type button:ImageButton}">
  912. <Setter Property="VerticalContentAlignment" Value="Center" />
  913. <Setter Property="HorizontalContentAlignment" Value="Center" />
  914. <Setter Property="NormalImageSource" Value="{DynamicResource AccountHideImage}" />
  915. <Setter Property="HoverImageSource" Value="{DynamicResource AccountHideImage}" />
  916. <Setter Property="Template">
  917. <Setter.Value>
  918. <ControlTemplate TargetType="{x:Type button:ImageButton}">
  919. <Border x:Name="ContentContainer" CornerRadius="1">
  920. <Image x:Name="image"
  921. Width="{TemplateBinding ImageWidth}"
  922. Height="{TemplateBinding ImageHeight}"
  923. Source="{TemplateBinding NormalImageSource}"
  924. Stretch="Uniform" />
  925. </Border>
  926. <ControlTemplate.Triggers>
  927. <Trigger Property="IsChecked" Value="True">
  928. <Setter Property="NormalImageSource" Value="{DynamicResource AccountHideImage_p}" />
  929. </Trigger>
  930. <Trigger Property="IsMouseOver" Value="True">
  931. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  932. </Trigger>
  933. </ControlTemplate.Triggers>
  934. </ControlTemplate>
  935. </Setter.Value>
  936. </Setter>
  937. </Style>
  938. <!-- 窗口关闭按钮样式 -->
  939. <Style x:Key="DialogCloseButtonStyle" TargetType="{x:Type Button}">
  940. <Setter Property="BorderThickness" Value="0" />
  941. <Setter Property="Height" Value="20" />
  942. <Setter Property="Width" Value="20" />
  943. <Setter Property="HorizontalContentAlignment" Value="Center" />
  944. <Setter Property="VerticalContentAlignment" Value="Center" />
  945. <Setter Property="Template">
  946. <Setter.Value>
  947. <ControlTemplate TargetType="{x:Type Button}">
  948. <Border x:Name="ContentContainer" CornerRadius="2">
  949. <Image x:Name="image"
  950. Source="{DynamicResource DialogCloseImg}"
  951. Stretch="Uniform" />
  952. </Border>
  953. <ControlTemplate.Triggers>
  954. <Trigger Property="IsPressed" Value="true">
  955. <Setter TargetName="image" Property="Source" Value="{DynamicResource DialogCloseImg_P}" />
  956. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  957. </Trigger>
  958. <Trigger Property="IsMouseOver" Value="True">
  959. <Setter TargetName="ContentContainer" Property="Background" Value="{DynamicResource MuchinfoBrush50}" />
  960. </Trigger>
  961. </ControlTemplate.Triggers>
  962. </ControlTemplate>
  963. </Setter.Value>
  964. </Setter>
  965. </Style>
  966. <Style x:Key="RightTextBlockStyle" TargetType="{x:Type TextBlock}">
  967. <Setter Property="TextAlignment" Value="Right" />
  968. <Setter Property="Margin" Value="0,0,3,0" />
  969. <Setter Property="HorizontalAlignment" Value="Stretch" />
  970. </Style>
  971. <Style x:Key="lightComboboxStyle"
  972. BasedOn="{StaticResource BaseComboxStyle}"
  973. TargetType="{x:Type ComboBox}">
  974. <Setter Property="BorderThickness" Value="1" />
  975. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush7}" />
  976. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  977. </Style>
  978. <Style x:Key="lightLoginComboboxStyle"
  979. BasedOn="{StaticResource LoginComboxStyle}"
  980. TargetType="{x:Type ComboBox}">
  981. <Setter Property="BorderThickness" Value="1" />
  982. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush22}" />
  983. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  984. </Style>
  985. <Style x:Key="RepeatButtonStyle" TargetType="{x:Type RepeatButton}">
  986. <Setter Property="BorderThickness" Value="1" />
  987. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  988. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  989. <Setter Property="Padding" Value="0" />
  990. <Setter Property="Template">
  991. <Setter.Value>
  992. <ControlTemplate TargetType="{x:Type RepeatButton}">
  993. <Grid Background="{TemplateBinding Background}">
  994. <ContentPresenter Margin="{TemplateBinding Padding}"
  995. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  996. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  997. Content="{TemplateBinding Content}"
  998. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  999. ContentTemplate="{TemplateBinding ContentTemplate}" />
  1000. </Grid>
  1001. </ControlTemplate>
  1002. </Setter.Value>
  1003. </Setter>
  1004. </Style>
  1005. <BooleanToVisibilityConverter x:Key="ToVisibilityConverter" />
  1006. <Style x:Key="ButtonSpinnerStyle" TargetType="{x:Type xctk:ButtonSpinner}">
  1007. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush13}" />
  1008. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush22}" />
  1009. <Setter Property="BorderThickness" Value="1" />
  1010. <Setter Property="Focusable" Value="False" />
  1011. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  1012. <Setter Property="IsTabStop" Value="True" />
  1013. <Setter Property="VerticalContentAlignment" Value="Center" />
  1014. <Setter Property="Template">
  1015. <Setter.Value>
  1016. <ControlTemplate TargetType="{x:Type xctk:ButtonSpinner}">
  1017. <Border x:Name="Border"
  1018. Background="{TemplateBinding Background}"
  1019. BorderBrush="{TemplateBinding BorderBrush}"
  1020. BorderThickness="{TemplateBinding BorderThickness}"
  1021. SnapsToDevicePixels="True">
  1022. <Grid>
  1023. <Grid.ColumnDefinitions>
  1024. <ColumnDefinition Width="*" />
  1025. <ColumnDefinition Width="1" />
  1026. <ColumnDefinition Width="20" />
  1027. </Grid.ColumnDefinitions>
  1028. <ContentPresenter Margin="{TemplateBinding Padding}"
  1029. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  1030. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  1031. Content="{TemplateBinding Content}"
  1032. Focusable="False"
  1033. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  1034. <Border Grid.Column="1"
  1035. BorderBrush="{TemplateBinding BorderBrush}"
  1036. BorderThickness="{TemplateBinding BorderThickness}" />
  1037. <Grid Grid.Column="2"
  1038. HorizontalAlignment="Stretch"
  1039. Visibility="{TemplateBinding ShowButtonSpinner,
  1040. Converter={StaticResource ToVisibilityConverter}}">
  1041. <Grid.RowDefinitions>
  1042. <RowDefinition Height="*" />
  1043. <RowDefinition Height="1" />
  1044. <RowDefinition Height="*" />
  1045. </Grid.RowDefinitions>
  1046. <RepeatButton x:Name="PART_IncreaseButton"
  1047. IsTabStop="{TemplateBinding IsTabStop}"
  1048. Style="{DynamicResource RepeatButtonStyle}">
  1049. <RepeatButton.ContentTemplate>
  1050. <DataTemplate>
  1051. <Path Width="12"
  1052. Margin="0,3"
  1053. HorizontalAlignment="Center"
  1054. VerticalAlignment="Center"
  1055. Data="M57.946471,292.46228 L68.652254,275.94555 80.499987,292.46228"
  1056. Focusable="False"
  1057. SnapsToDevicePixels="True"
  1058. Stretch="Fill"
  1059. Stroke="{DynamicResource MuchinfoBrush22}"
  1060. StrokeThickness="1" />
  1061. </DataTemplate>
  1062. </RepeatButton.ContentTemplate>
  1063. </RepeatButton>
  1064. <Border Grid.Row="1"
  1065. HorizontalAlignment="Stretch"
  1066. BorderBrush="{TemplateBinding BorderBrush}"
  1067. BorderThickness="{TemplateBinding BorderThickness}" />
  1068. <RepeatButton x:Name="PART_DecreaseButton"
  1069. Grid.Row="2"
  1070. IsTabStop="{TemplateBinding IsTabStop}"
  1071. Style="{DynamicResource RepeatButtonStyle}">
  1072. <RepeatButton.ContentTemplate>
  1073. <DataTemplate>
  1074. <Path Width="12"
  1075. Margin="0,3"
  1076. HorizontalAlignment="Center"
  1077. VerticalAlignment="Center"
  1078. Data="M58,276 L69.036054,292.40871 80.517829,276.05476"
  1079. Focusable="False"
  1080. SnapsToDevicePixels="True"
  1081. Stretch="Fill"
  1082. Stroke="{DynamicResource MuchinfoBrush22}"
  1083. StrokeThickness="1" />
  1084. </DataTemplate>
  1085. </RepeatButton.ContentTemplate>
  1086. </RepeatButton>
  1087. </Grid>
  1088. </Grid>
  1089. </Border>
  1090. <ControlTemplate.Triggers>
  1091. <Trigger SourceName="PART_IncreaseButton" Property="IsPressed" Value="True">
  1092. <Setter TargetName="PART_IncreaseButton" Property="Background" Value="#FFBC9E62" />
  1093. </Trigger>
  1094. <Trigger SourceName="PART_DecreaseButton" Property="IsPressed" Value="True">
  1095. <Setter TargetName="PART_DecreaseButton" Property="Background" Value="#FFBC9E62" />
  1096. </Trigger>
  1097. <Trigger SourceName="PART_IncreaseButton" Property="IsEnabled" Value="False">
  1098. <Setter TargetName="PART_IncreaseButton" Property="ContentTemplate">
  1099. <Setter.Value>
  1100. <DataTemplate>
  1101. <Path Width="12"
  1102. Margin="0,3"
  1103. HorizontalAlignment="Center"
  1104. VerticalAlignment="Center"
  1105. Data="M57.946471,292.46228 L68.652254,275.94555 80.499987,292.46228"
  1106. Focusable="False"
  1107. SnapsToDevicePixels="True"
  1108. Stretch="Fill"
  1109. Stroke="{DynamicResource MuchinfoBrush14}"
  1110. StrokeThickness="1" />
  1111. </DataTemplate>
  1112. </Setter.Value>
  1113. </Setter>
  1114. </Trigger>
  1115. <Trigger SourceName="PART_DecreaseButton" Property="IsEnabled" Value="False">
  1116. <Setter TargetName="PART_DecreaseButton" Property="ContentTemplate">
  1117. <Setter.Value>
  1118. <DataTemplate>
  1119. <Path Width="12"
  1120. Margin="0,3"
  1121. HorizontalAlignment="Center"
  1122. VerticalAlignment="Center"
  1123. Data="M58,276 L69.036054,292.40871 80.517829,276.05476"
  1124. Focusable="False"
  1125. SnapsToDevicePixels="True"
  1126. Stretch="Fill"
  1127. Stroke="{DynamicResource MuchinfoBrush14}"
  1128. StrokeThickness="1" />
  1129. </DataTemplate>
  1130. </Setter.Value>
  1131. </Setter>
  1132. </Trigger>
  1133. </ControlTemplate.Triggers>
  1134. </ControlTemplate>
  1135. </Setter.Value>
  1136. </Setter>
  1137. </Style>
  1138. <!-- 设置数字控件中的样式 -->
  1139. <Style x:Key="WatermarkTextBoxStyle" TargetType="{x:Type xctk:WatermarkTextBox}">
  1140. <Setter Property="AllowDrop" Value="True" />
  1141. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  1142. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  1143. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  1144. <Setter Property="WatermarkTemplate">
  1145. <Setter.Value>
  1146. <DataTemplate>
  1147. <ContentControl Content="{Binding}"
  1148. Focusable="False"
  1149. Foreground="{DynamicResource MuchinfoBrush1}" />
  1150. </DataTemplate>
  1151. </Setter.Value>
  1152. </Setter>
  1153. <Setter Property="Template">
  1154. <Setter.Value>
  1155. <ControlTemplate TargetType="{x:Type xctk:WatermarkTextBox}">
  1156. <Grid>
  1157. <Border x:Name="Border"
  1158. Background="{TemplateBinding Background}"
  1159. BorderBrush="{TemplateBinding BorderBrush}"
  1160. BorderThickness="{TemplateBinding BorderThickness}"
  1161. CornerRadius="1" />
  1162. <Border x:Name="MouseOverVisual"
  1163. BorderThickness="{TemplateBinding BorderThickness}"
  1164. CornerRadius="1"
  1165. Opacity="0">
  1166. <Border.BorderBrush>
  1167. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  1168. <GradientStop Offset="0.05" Color="#FF5794BF" />
  1169. <GradientStop Offset="0.07" Color="#FFB7D5EA" />
  1170. <GradientStop Offset="1" Color="#FFC7E2F1" />
  1171. </LinearGradientBrush>
  1172. </Border.BorderBrush>
  1173. </Border>
  1174. <Border x:Name="FocusVisual"
  1175. BorderThickness="{TemplateBinding BorderThickness}"
  1176. CornerRadius="1"
  1177. Opacity="0">
  1178. <Border.BorderBrush>
  1179. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  1180. <GradientStop Offset="0.05" Color="#FF3D7BAD" />
  1181. <GradientStop Offset="0.07" Color="#FFA4C9E3" />
  1182. <GradientStop Offset="1" Color="#FFB7D9ED" />
  1183. </LinearGradientBrush>
  1184. </Border.BorderBrush>
  1185. </Border>
  1186. <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  1187. <ContentPresenter x:Name="PART_WatermarkHost"
  1188. Margin="{TemplateBinding Padding}"
  1189. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  1190. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  1191. Content="{TemplateBinding Watermark}"
  1192. ContentTemplate="{TemplateBinding WatermarkTemplate}"
  1193. IsHitTestVisible="False"
  1194. Visibility="Collapsed" />
  1195. </Grid>
  1196. <ControlTemplate.Triggers>
  1197. <MultiTrigger>
  1198. <MultiTrigger.Conditions>
  1199. <Condition Property="IsFocused" Value="False" />
  1200. <Condition Property="Text" Value="" />
  1201. </MultiTrigger.Conditions>
  1202. <Setter TargetName="PART_WatermarkHost" Property="Visibility" Value="Visible" />
  1203. </MultiTrigger>
  1204. <Trigger Property="IsMouseOver" Value="True">
  1205. <Setter TargetName="MouseOverVisual" Property="Opacity" Value="1" />
  1206. </Trigger>
  1207. <Trigger Property="IsFocused" Value="True">
  1208. <Setter TargetName="FocusVisual" Property="Opacity" Value="1" />
  1209. </Trigger>
  1210. </ControlTemplate.Triggers>
  1211. </ControlTemplate>
  1212. </Setter.Value>
  1213. </Setter>
  1214. </Style>
  1215. <!-- tookit SingleUpDown 样式 -->
  1216. <Style x:Key="SingleUpDownStyle" TargetType="{x:Type xctk:SingleUpDown}">
  1217. <Setter Property="Height" Value="24" />
  1218. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  1219. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush7}" />
  1220. <Setter Property="BorderThickness" Value="1" />
  1221. <Setter Property="Padding" Value="0" />
  1222. <Setter Property="ClipValueToMinMax" Value="True" />
  1223. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush10}" />
  1224. <Setter Property="HorizontalContentAlignment" Value="Right" />
  1225. <Setter Property="IsTabStop" Value="False" />
  1226. <Setter Property="VerticalContentAlignment" Value="Center" />
  1227. <Setter Property="TextAlignment" Value="Right" />
  1228. <Setter Property="WatermarkTemplate">
  1229. <Setter.Value>
  1230. <DataTemplate>
  1231. <ContentControl Margin="0,0,3,0"
  1232. Content="{Binding}"
  1233. Focusable="False"
  1234. Foreground="{DynamicResource MuchinfoBrush1}" />
  1235. </DataTemplate>
  1236. </Setter.Value>
  1237. </Setter>
  1238. <Setter Property="Template">
  1239. <Setter.Value>
  1240. <ControlTemplate TargetType="{x:Type xctk:SingleUpDown}">
  1241. <Grid>
  1242. <xctk:ButtonSpinner x:Name="PART_Spinner"
  1243. AllowSpin="{Binding AllowSpin,
  1244. RelativeSource={RelativeSource TemplatedParent}}"
  1245. Background="{TemplateBinding Background}"
  1246. BorderBrush="{TemplateBinding BorderBrush}"
  1247. BorderThickness="{TemplateBinding BorderThickness}"
  1248. IsTabStop="False"
  1249. ShowButtonSpinner="{Binding ShowButtonSpinner,
  1250. RelativeSource={RelativeSource TemplatedParent}}"
  1251. Style="{DynamicResource ButtonSpinnerStyle}">
  1252. <xctk:WatermarkTextBox x:Name="PART_TextBox"
  1253. MinWidth="20"
  1254. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  1255. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  1256. AcceptsReturn="False"
  1257. AutoMoveFocus="{Binding AutoMoveFocus,
  1258. RelativeSource={RelativeSource TemplatedParent}}"
  1259. AutoSelectBehavior="{Binding AutoSelectBehavior,
  1260. RelativeSource={RelativeSource TemplatedParent}}"
  1261. Background="Transparent"
  1262. BorderBrush="Transparent"
  1263. BorderThickness="0"
  1264. ContextMenu="{TemplateBinding ContextMenu}"
  1265. FontFamily="{TemplateBinding FontFamily}"
  1266. FontSize="{TemplateBinding FontSize}"
  1267. FontStretch="{TemplateBinding FontStretch}"
  1268. FontStyle="{TemplateBinding FontStyle}"
  1269. FontWeight="{TemplateBinding FontWeight}"
  1270. Foreground="{TemplateBinding Foreground}"
  1271. IsReadOnly="{Binding IsReadOnly,
  1272. RelativeSource={RelativeSource TemplatedParent}}"
  1273. Padding="{TemplateBinding Padding}"
  1274. SelectAllOnGotFocus="{Binding SelectAllOnGotFocus,
  1275. RelativeSource={RelativeSource TemplatedParent}}"
  1276. Style="{StaticResource WatermarkTextBoxStyle}"
  1277. TabIndex="{TemplateBinding TabIndex}"
  1278. TextAlignment="{Binding TextAlignment,
  1279. RelativeSource={RelativeSource TemplatedParent}}"
  1280. TextWrapping="NoWrap"
  1281. Watermark="{Binding Watermark,
  1282. RelativeSource={RelativeSource TemplatedParent}}"
  1283. WatermarkTemplate="{Binding WatermarkTemplate,
  1284. RelativeSource={RelativeSource TemplatedParent}}" />
  1285. </xctk:ButtonSpinner>
  1286. <Rectangle x:Name="enableRectangle"
  1287. Grid.ColumnSpan="3"
  1288. Fill="{DynamicResource MuchinfoBrush7}"
  1289. Opacity="0.7"
  1290. Visibility="Collapsed" />
  1291. </Grid>
  1292. <ControlTemplate.Triggers>
  1293. <Trigger Property="IsEnabled" Value="False">
  1294. <!-- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> -->
  1295. <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
  1296. </Trigger>
  1297. <Trigger Property="IsFocused" Value="True">
  1298. <Setter TargetName="PART_TextBox" Property="FocusManager.FocusedElement" Value="{Binding ElementName=PART_TextBox}" />
  1299. </Trigger>
  1300. </ControlTemplate.Triggers>
  1301. </ControlTemplate>
  1302. </Setter.Value>
  1303. </Setter>
  1304. </Style>
  1305. <!-- tookit SingleUpDown 样式 -->
  1306. <Style x:Key="DecimalUpDownStyle" TargetType="{x:Type xctk:DecimalUpDown}">
  1307. <Setter Property="Height" Value="24" />
  1308. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  1309. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush7}" />
  1310. <Setter Property="BorderThickness" Value="1" />
  1311. <Setter Property="Padding" Value="0" />
  1312. <Setter Property="ClipValueToMinMax" Value="True" />
  1313. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush10}" />
  1314. <Setter Property="HorizontalContentAlignment" Value="Right" />
  1315. <Setter Property="IsTabStop" Value="False" />
  1316. <Setter Property="VerticalContentAlignment" Value="Center" />
  1317. <Setter Property="TextAlignment" Value="Right" />
  1318. <Setter Property="WatermarkTemplate">
  1319. <Setter.Value>
  1320. <DataTemplate>
  1321. <ContentControl Margin="0,0,3,0"
  1322. Content="{Binding}"
  1323. Focusable="False"
  1324. Foreground="{DynamicResource MuchinfoBrush1}" />
  1325. </DataTemplate>
  1326. </Setter.Value>
  1327. </Setter>
  1328. <Setter Property="Template">
  1329. <Setter.Value>
  1330. <ControlTemplate TargetType="{x:Type xctk:DecimalUpDown}">
  1331. <Grid>
  1332. <xctk:ButtonSpinner x:Name="PART_Spinner"
  1333. AllowSpin="{Binding AllowSpin,
  1334. RelativeSource={RelativeSource TemplatedParent}}"
  1335. Background="{TemplateBinding Background}"
  1336. BorderBrush="{TemplateBinding BorderBrush}"
  1337. BorderThickness="{TemplateBinding BorderThickness}"
  1338. IsTabStop="False"
  1339. ShowButtonSpinner="{Binding ShowButtonSpinner,
  1340. RelativeSource={RelativeSource TemplatedParent}}"
  1341. Style="{DynamicResource ButtonSpinnerStyle}">
  1342. <xctk:WatermarkTextBox x:Name="PART_TextBox"
  1343. MinWidth="20"
  1344. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  1345. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  1346. AcceptsReturn="False"
  1347. AutoMoveFocus="{Binding AutoMoveFocus,
  1348. RelativeSource={RelativeSource TemplatedParent}}"
  1349. AutoSelectBehavior="{Binding AutoSelectBehavior,
  1350. RelativeSource={RelativeSource TemplatedParent}}"
  1351. Background="Transparent"
  1352. BorderBrush="Transparent"
  1353. BorderThickness="0"
  1354. ContextMenu="{TemplateBinding ContextMenu}"
  1355. FontFamily="{TemplateBinding FontFamily}"
  1356. FontSize="{TemplateBinding FontSize}"
  1357. FontStretch="{TemplateBinding FontStretch}"
  1358. FontStyle="{TemplateBinding FontStyle}"
  1359. FontWeight="{TemplateBinding FontWeight}"
  1360. Foreground="{TemplateBinding Foreground}"
  1361. IsReadOnly="{Binding IsReadOnly,
  1362. RelativeSource={RelativeSource TemplatedParent}}"
  1363. Padding="{TemplateBinding Padding}"
  1364. SelectAllOnGotFocus="{Binding SelectAllOnGotFocus,
  1365. RelativeSource={RelativeSource TemplatedParent}}"
  1366. Style="{StaticResource WatermarkTextBoxStyle}"
  1367. TabIndex="{TemplateBinding TabIndex}"
  1368. TextAlignment="{Binding TextAlignment,
  1369. RelativeSource={RelativeSource TemplatedParent}}"
  1370. TextWrapping="NoWrap"
  1371. Watermark="{Binding Watermark,
  1372. RelativeSource={RelativeSource TemplatedParent}}"
  1373. WatermarkTemplate="{Binding WatermarkTemplate,
  1374. RelativeSource={RelativeSource TemplatedParent}}" />
  1375. </xctk:ButtonSpinner>
  1376. <Rectangle x:Name="enableRectangle"
  1377. Grid.ColumnSpan="3"
  1378. Fill="{DynamicResource MuchinfoBrush7}"
  1379. Opacity="0.7"
  1380. Visibility="Collapsed" />
  1381. </Grid>
  1382. <ControlTemplate.Triggers>
  1383. <Trigger Property="IsEnabled" Value="False">
  1384. <!-- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> -->
  1385. <Setter TargetName="enableRectangle" Property="Visibility" Value="Visible" />
  1386. </Trigger>
  1387. <Trigger Property="IsFocused" Value="True">
  1388. <Setter TargetName="PART_TextBox" Property="FocusManager.FocusedElement" Value="{Binding ElementName=PART_TextBox}" />
  1389. </Trigger>
  1390. </ControlTemplate.Triggers>
  1391. </ControlTemplate>
  1392. </Setter.Value>
  1393. </Setter>
  1394. </Style>
  1395. <!-- 竞价使用样式 -->
  1396. <Style x:Key="BidPriceListBox" TargetType="{x:Type ListBox}">
  1397. <Setter Property="SnapsToDevicePixels" Value="true" />
  1398. <Setter Property="Background" Value="Transparent" />
  1399. <Setter Property="BorderBrush" Value="Transparent" />
  1400. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush13}" />
  1401. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
  1402. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
  1403. <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
  1404. <Setter Property="Template">
  1405. <Setter.Value>
  1406. <ControlTemplate TargetType="{x:Type ListBox}">
  1407. <Grid>
  1408. <Border x:Name="Border"
  1409. BorderBrush="{TemplateBinding BorderBrush}"
  1410. BorderThickness="{TemplateBinding BorderThickness}" />
  1411. <ScrollViewer Margin="1"
  1412. Background="{TemplateBinding Background}"
  1413. Focusable="false"
  1414. Style="{DynamicResource SimpleScrollViewer}">
  1415. <!-- StackPanel 用来显示子级,方法是将 IsItemsHost 设置为 True -->
  1416. <StackPanel Margin="2" IsItemsHost="true" />
  1417. </ScrollViewer>
  1418. </Grid>
  1419. <ControlTemplate.Triggers>
  1420. <Trigger Property="IsEnabled" Value="false">
  1421. <Setter TargetName="Border" Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" />
  1422. <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" />
  1423. </Trigger>
  1424. <Trigger Property="IsGrouping" Value="true">
  1425. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  1426. </Trigger>
  1427. </ControlTemplate.Triggers>
  1428. </ControlTemplate>
  1429. </Setter.Value>
  1430. </Setter>
  1431. </Style>
  1432. <!-- Simple ListBoxItem - 它用于 ListBox 中的每个项。该项的内容置于 ContentPresenter 中 -->
  1433. <Style x:Key="BidPriceListBoxItem" TargetType="ListBoxItem">
  1434. <Setter Property="VerticalContentAlignment" Value="Center" />
  1435. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  1436. <Setter Property="Height" Value="20" />
  1437. <Setter Property="SnapsToDevicePixels" Value="true" />
  1438. <Setter Property="Margin" Value="2,1" />
  1439. <Setter Property="OverridesDefaultStyle" Value="true" />
  1440. <Setter Property="Template">
  1441. <Setter.Value>
  1442. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  1443. <Grid SnapsToDevicePixels="true">
  1444. <Border x:Name="Border"
  1445. Background="{TemplateBinding Background}"
  1446. BorderBrush="{TemplateBinding BorderBrush}"
  1447. BorderThickness="{TemplateBinding BorderThickness}" />
  1448. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  1449. </Grid>
  1450. <ControlTemplate.Triggers>
  1451. <Trigger Property="IsEnabled" Value="false">
  1452. <Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}" />
  1453. </Trigger>
  1454. </ControlTemplate.Triggers>
  1455. </ControlTemplate>
  1456. </Setter.Value>
  1457. </Setter>
  1458. </Style>
  1459. <!-- 此 BitmapEffect 供 Simple MenuItem 使用 -->
  1460. <DropShadowBitmapEffect x:Key="PopupDropShadow"
  1461. ShadowDepth="1.5"
  1462. Softness="0.15" />
  1463. <!-- Simple MenuItem x:Key="SimpleMenuItem" - 该模板使用触发器来提供四种不同的菜单项排列方式,这些排列方式是通过 Role 属性设置的 -->
  1464. <Style x:Key="CommonMenuItem" TargetType="{x:Type MenuItem}">
  1465. <Setter Property="Height" Value="22" />
  1466. <Setter Property="MinWidth" Value="40" />
  1467. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush38}" />
  1468. <Setter Property="HorizontalContentAlignment" Value="Center" />
  1469. <Setter Property="VerticalContentAlignment" Value="Center" />
  1470. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush39}" />
  1471. <Setter Property="BorderThickness" Value="0,0,0,1" />
  1472. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush13}" />
  1473. <Setter Property="Template" Value="{DynamicResource CommonMenuItemTemplate}" />
  1474. </Style>
  1475. <ControlTemplate x:Key="CommonMenuItemTemplate" TargetType="{x:Type MenuItem}">
  1476. <Border x:Name="Border"
  1477. Background="{TemplateBinding Background}"
  1478. BorderBrush="{TemplateBinding BorderBrush}"
  1479. BorderThickness="{TemplateBinding BorderThickness}">
  1480. <Grid>
  1481. <!--
  1482. Grid 用于结合 Icon、Content、Glyph 复选标记和 Arrow 的列,以显示下一个级别
  1483. Grid 中采用大小共享方式,以便将每个 MenuItem 的 Icon、Content 和 Arrow 一起对齐
  1484. -->
  1485. <Grid.ColumnDefinitions>
  1486. <ColumnDefinition Width="Auto"
  1487. MinWidth="17"
  1488. SharedSizeGroup="MenuItemIconColumnGroup" />
  1489. <ColumnDefinition Width="*" />
  1490. <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup" />
  1491. <ColumnDefinition Width="14" />
  1492. </Grid.ColumnDefinitions>
  1493. <!-- ContentPresenter 用来显示 Icon (如果需要) -->
  1494. <ContentPresenter x:Name="Icon"
  1495. Margin="4,0,6,0"
  1496. VerticalAlignment="Center"
  1497. ContentSource="Icon" />
  1498. <!-- Glyph 是一个复选标记(如果可选中的菜单需要) -->
  1499. <Grid x:Name="GlyphPanel"
  1500. Margin="4,0,6,0"
  1501. VerticalAlignment="Center"
  1502. Visibility="Hidden">
  1503. <Path x:Name="GlyphPanelpath"
  1504. VerticalAlignment="Center"
  1505. Data="M0,2 L0,4.8 L2.5,7.4 L7.1,2.8 L7.1,0 L2.5,4.6 z"
  1506. Fill="{TemplateBinding Foreground}"
  1507. FlowDirection="LeftToRight" />
  1508. </Grid>
  1509. <!-- 菜单文本等内容 -->
  1510. <ContentPresenter x:Name="HeaderHost"
  1511. Grid.Column="1"
  1512. Margin="{TemplateBinding Padding}"
  1513. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  1514. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  1515. ContentSource="Header"
  1516. RecognizesAccessKey="True" />
  1517. <!-- 箭头绘制的路径,该路径指向菜单的下一个级别 -->
  1518. <Grid x:Name="ArrowPanel"
  1519. Grid.Column="3"
  1520. Margin="4,0,6,0"
  1521. HorizontalAlignment="Center"
  1522. VerticalAlignment="Center">
  1523. <Path x:Name="ArrowPanelPath"
  1524. VerticalAlignment="Center"
  1525. Data="M0,0 L0,8 L4,4 z"
  1526. Fill="{DynamicResource MuchinfoBrush2}" />
  1527. </Grid>
  1528. <!-- Popup 是向下展开或横向展开(具体取决于该项所处的级别)的菜单的主体 -->
  1529. <Popup x:Name="SubMenuPopup"
  1530. AllowsTransparency="true"
  1531. Focusable="false"
  1532. IsOpen="{Binding Path=IsSubmenuOpen,
  1533. RelativeSource={RelativeSource TemplatedParent}}"
  1534. Placement="Right"
  1535. PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}"
  1536. VerticalOffset="-3">
  1537. <Grid x:Name="SubMenu">
  1538. <!-- <Border x:Name="SubMenuBorder" Background="{DynamicResource WindowBackgroundBrush}" BorderBrush="{DynamicResource SolidBorderBrush}" BorderThickness="1"/> -->
  1539. <!-- StackPanel 保留菜单的子级。这是通过 IsItemsHost=True 来设置的 -->
  1540. <Border x:Name="SubMenuBorder"
  1541. BorderBrush="{DynamicResource MuchinfoBrush40}"
  1542. BorderThickness="1">
  1543. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
  1544. </Border>
  1545. </Grid>
  1546. </Popup>
  1547. </Grid>
  1548. </Border>
  1549. <!-- 这些触发器通过 Role 重新配置 MenuItem 的四种排列方式以显示不同级别的菜单 -->
  1550. <ControlTemplate.Triggers>
  1551. <!-- Role = TopLevelHeader: 这是菜单中的根菜单项;Popup 向下展开 -->
  1552. <Trigger Property="Role" Value="TopLevelHeader">
  1553. <Setter Property="Margin" Value="0,1,0,1" />
  1554. <Setter Property="Padding" Value="6,3,6,3" />
  1555. <Setter Property="Grid.IsSharedSizeScope" Value="true" />
  1556. <Setter TargetName="SubMenuPopup" Property="Placement" Value="Bottom" />
  1557. <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
  1558. </Trigger>
  1559. <!-- Role = TopLevelItem: 这是没有任何子项的顶级菜单的子菜单项 -->
  1560. <Trigger Property="Role" Value="TopLevelItem">
  1561. <Setter Property="Margin" Value="0,1,0,1" />
  1562. <Setter Property="Padding" Value="6,3,6,3" />
  1563. <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
  1564. </Trigger>
  1565. <!-- Role = SubMenuHeader: 这是不包含子级的子菜单项 -->
  1566. <Trigger Property="Role" Value="SubmenuHeader">
  1567. <Setter Property="DockPanel.Dock" Value="Top" />
  1568. <Setter Property="Padding" Value="0,2,0,2" />
  1569. <Setter Property="Grid.IsSharedSizeScope" Value="true" />
  1570. </Trigger>
  1571. <!-- Role = SubMenuItem: 这是包含子级的子菜单项 -->
  1572. <Trigger Property="Role" Value="SubmenuItem">
  1573. <Setter Property="DockPanel.Dock" Value="Top" />
  1574. <Setter Property="Padding" Value="0,2,0,2" />
  1575. <Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
  1576. </Trigger>
  1577. <Trigger Property="IsSuspendingPopupAnimation" Value="true">
  1578. <Setter TargetName="SubMenuPopup" Property="PopupAnimation" Value="None" />
  1579. </Trigger>
  1580. <!-- 如果不存在 Icon,我们会折叠 Icon Content -->
  1581. <Trigger Property="Icon" Value="{x:Null}">
  1582. <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
  1583. </Trigger>
  1584. <!-- GlyphPanel 包含 CheckMark -->
  1585. <Trigger Property="IsChecked" Value="true">
  1586. <Setter TargetName="GlyphPanel" Property="Visibility" Value="Visible" />
  1587. <Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
  1588. </Trigger>
  1589. <Trigger SourceName="SubMenuPopup" Property="AllowsTransparency" Value="true">
  1590. <Setter TargetName="SubMenu" Property="Margin" Value="0,0,3,3" />
  1591. <Setter TargetName="SubMenu" Property="SnapsToDevicePixels" Value="true" />
  1592. <Setter TargetName="SubMenuBorder" Property="BitmapEffect" Value="{DynamicResource PopupDropShadow}" />
  1593. </Trigger>
  1594. <!-- 对 Menu Highlight 和 IsEnabled 使用系统颜色 -->
  1595. <Trigger Property="IsHighlighted" Value="true">
  1596. <Setter TargetName="Border" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  1597. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush5}" />
  1598. </Trigger>
  1599. <Trigger Property="IsEnabled" Value="false">
  1600. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  1601. </Trigger>
  1602. </ControlTemplate.Triggers>
  1603. </ControlTemplate>
  1604. <!-- 上下文菜单 -->
  1605. <Style TargetType="ContextMenu">
  1606. <Setter Property="BorderThickness" Value="1" />
  1607. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush40}" />
  1608. </Style>
  1609. <ControlTemplate x:Key="NewsToggleButton" TargetType="{x:Type ToggleButton}">
  1610. <Border x:Name="Border"
  1611. BorderThickness="0"
  1612. CornerRadius="2"
  1613. TextBlock.Foreground="{DynamicResource MuchinfoBrush10}">
  1614. <ContentPresenter Margin="5,1,5,1"
  1615. HorizontalAlignment="Center"
  1616. VerticalAlignment="Center"
  1617. Content="{TemplateBinding Content}" />
  1618. </Border>
  1619. <ControlTemplate.Triggers>
  1620. <Trigger Property="IsMouseOver" Value="true">
  1621. <Setter TargetName="Border" Property="BorderThickness" Value="0,0,0,2" />
  1622. <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MuchinfoBrush3}" />
  1623. </Trigger>
  1624. <Trigger Property="IsChecked" Value="true">
  1625. <Setter TargetName="Border" Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  1626. <Setter TargetName="Border" Property="TextBlock.Foreground" Value="{DynamicResource MuchinfoBrush1}" />
  1627. </Trigger>
  1628. </ControlTemplate.Triggers>
  1629. </ControlTemplate>
  1630. <Style x:Key="WindowBaseStyle" TargetType="windows:WindowBase">
  1631. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush66}" />
  1632. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush6}" />
  1633. <Setter Property="BorderThickness" Value="1" />
  1634. <Setter Property="CloseButtonStyle" Value="{DynamicResource DialogCloseButtonStyle}" />
  1635. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush81}" />
  1636. <Setter Property="TitleBackGround" Value="{DynamicResource MuchinfoBrush6}" />
  1637. </Style>
  1638. <Style TargetType="{x:Type windows:MuchinfoMessageBox}">
  1639. <Setter Property="ButtonStyle" Value="{DynamicResource CommonButtonStyle}" />
  1640. </Style>
  1641. <Style x:Key="ButtonNotIsEnable" TargetType="Button">
  1642. <Setter Property="Width" Value="110" />
  1643. <Setter Property="Height" Value="20" />
  1644. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush12}" />
  1645. <Setter Property="Background" Value="#CCCCCC" />
  1646. <Setter Property="BorderThickness" Value="0" />
  1647. <Setter Property="Padding" Value="20,5" />
  1648. <Setter Property="FocusVisualStyle" Value="{DynamicResource ButtonFocusVisual}" />
  1649. <Setter Property="Template">
  1650. <Setter.Value>
  1651. <ControlTemplate>
  1652. <Border Name="Part_BackGround"
  1653. Background="{TemplateBinding Background}"
  1654. BorderBrush="{TemplateBinding Control.BorderBrush}"
  1655. BorderThickness="0"
  1656. CornerRadius="4,4,0,0">
  1657. <ContentPresenter HorizontalAlignment="Center"
  1658. VerticalAlignment="Center"
  1659. Content="{TemplateBinding ContentControl.Content}" />
  1660. </Border>
  1661. </ControlTemplate>
  1662. </Setter.Value>
  1663. </Setter>
  1664. </Style>
  1665. <Style x:Key="ButtonIsEnable"
  1666. BasedOn="{StaticResource ButtonNotIsEnable}"
  1667. TargetType="Button">
  1668. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush3}" />
  1669. </Style>
  1670. </ResourceDictionary>