ButtonStyle.xaml 101 KB

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