Application.xaml 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <Application x:Class="Application"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:PCL"
  5. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  6. StartupUri="FormMain.xaml"
  7. ShutdownMode="OnExplicitShutdown">
  8. <Application.Resources>
  9. <ResourceDictionary>
  10. <!-- 本地化 -->
  11. <ResourceDictionary.MergedDictionaries>
  12. <ResourceDictionary Source="pack://application:,,,/Resources/Language/zh_CN.xaml" />
  13. <ResourceDictionary Source="pack://application:,,,/Resources/Language/zh_CN.xaml" />
  14. </ResourceDictionary.MergedDictionaries>
  15. <!-- Converter -->
  16. <local:AdditionConverter x:Key="AdditionConverter"/>
  17. <local:MultiplicationConverter x:Key="MultiplicationConverter"/>
  18. <local:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
  19. <local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
  20. <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
  21. <!-- 颜色表 -->
  22. <SolidColorBrush x:Key="ColorBrush1">#343d4a</SolidColorBrush>
  23. <SolidColorBrush x:Key="ColorBrush2">#0b5bcb</SolidColorBrush>
  24. <SolidColorBrush x:Key="ColorBrush3">#1370f3</SolidColorBrush>
  25. <SolidColorBrush x:Key="ColorBrush4">#4890f5</SolidColorBrush>
  26. <SolidColorBrush x:Key="ColorBrush5">#96c0f9</SolidColorBrush>
  27. <SolidColorBrush x:Key="ColorBrush6">#d5e6fd</SolidColorBrush>
  28. <SolidColorBrush x:Key="ColorBrush7">#e0eafd</SolidColorBrush>
  29. <SolidColorBrush x:Key="ColorBrush8">#eaf2fe</SolidColorBrush>
  30. <SolidColorBrush x:Key="ColorBrushBg0">#96c0f9</SolidColorBrush>
  31. <SolidColorBrush x:Key="ColorBrushBg1">#bee0eafd</SolidColorBrush>
  32. <Color x:Key="ColorObject1">#343d4a</Color>
  33. <Color x:Key="ColorObject2">#0b5bcb</Color>
  34. <Color x:Key="ColorObject3">#1370f3</Color>
  35. <Color x:Key="ColorObject4">#4890f5</Color>
  36. <Color x:Key="ColorObject5">#96c0f9</Color>
  37. <Color x:Key="ColorObject6">#d5e6fd</Color>
  38. <Color x:Key="ColorObject7">#e0eafd</Color>
  39. <Color x:Key="ColorObject8">#eaf2fe</Color>
  40. <Color x:Key="ColorObjectBg0">#96c0f9</Color>
  41. <Color x:Key="ColorObjectBg1">#bee0eafd</Color>
  42. <SolidColorBrush x:Key="ColorBrushGray1">#404040</SolidColorBrush>
  43. <SolidColorBrush x:Key="ColorBrushGray2">#737373</SolidColorBrush>
  44. <SolidColorBrush x:Key="ColorBrushGray3">#8c8c8c</SolidColorBrush>
  45. <SolidColorBrush x:Key="ColorBrushGray4">#a6a6a6</SolidColorBrush>
  46. <SolidColorBrush x:Key="ColorBrushGray5">#cccccc</SolidColorBrush>
  47. <SolidColorBrush x:Key="ColorBrushGray6">#ebebeb</SolidColorBrush>
  48. <SolidColorBrush x:Key="ColorBrushGray7">#f0f0f0</SolidColorBrush>
  49. <SolidColorBrush x:Key="ColorBrushGray8">#f5f5f5</SolidColorBrush>
  50. <Color x:Key="ColorObjectGray1">#404040</Color>
  51. <Color x:Key="ColorObjectGray2">#737373</Color>
  52. <Color x:Key="ColorObjectGray3">#8c8c8c</Color>
  53. <Color x:Key="ColorObjectGray4">#a6a6a6</Color>
  54. <Color x:Key="ColorObjectGray5">#cccccc</Color>
  55. <Color x:Key="ColorObjectGray6">#ebebeb</Color>
  56. <Color x:Key="ColorObjectGray7">#f0f0f0</Color>
  57. <Color x:Key="ColorObjectGray8">#f5f5f5</Color>
  58. <SolidColorBrush x:Key="ColorBrushRedBack">#80fbdddd</SolidColorBrush>
  59. <SolidColorBrush x:Key="ColorBrushRedLight">#ff4c4c</SolidColorBrush>
  60. <SolidColorBrush x:Key="ColorBrushRedDark">#ce2111</SolidColorBrush>
  61. <SolidColorBrush x:Key="ColorBrushHalfWhite" Color="#55ffffff" />
  62. <SolidColorBrush x:Key="ColorBrushSemiWhite" Color="#bbffffff" />
  63. <SolidColorBrush x:Key="ColorBrushWhite" Color="#ffffff" />
  64. <SolidColorBrush x:Key="ColorBrushTransparent" Color="Transparent" />
  65. <SolidColorBrush x:Key="ColorBrushSemiTransparent">#01eaf2fe</SolidColorBrush>
  66. <SolidColorBrush x:Key="ColorBrushBackgroundTransparentSidebar" Color="#D2FFFFFF" />
  67. <!-- Window -->
  68. <Style TargetType="{x:Type Window}" x:Key="MyWindow">
  69. <Setter Property="OverridesDefaultStyle" Value="True"/>
  70. <Setter Property="Template">
  71. <Setter.Value>
  72. <ControlTemplate TargetType="{x:Type Window}">
  73. <ContentPresenter />
  74. </ControlTemplate>
  75. </Setter.Value>
  76. </Setter>
  77. </Style>
  78. <!-- Label -->
  79. <Style TargetType="Label">
  80. <Setter Property="OverridesDefaultStyle" Value="True"/>
  81. <Setter Property="Padding" Value="0"/>
  82. <Setter Property="Template">
  83. <Setter.Value>
  84. <ControlTemplate TargetType="Label">
  85. <Border Background="{TemplateBinding Background}">
  86. <ContentPresenter
  87. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  88. Margin="{TemplateBinding Padding}"
  89. RecognizesAccessKey="False"
  90. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  91. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  92. </Border>
  93. </ControlTemplate>
  94. </Setter.Value>
  95. </Setter>
  96. </Style>
  97. <Style TargetType="local:MyTextButton">
  98. <Setter Property="OverridesDefaultStyle" Value="True"/>
  99. <Setter Property="Padding" Value="0"/>
  100. <Setter Property="Template">
  101. <Setter.Value>
  102. <ControlTemplate TargetType="Label">
  103. <Border Background="{TemplateBinding Background}">
  104. <TextBlock
  105. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  106. Margin="{TemplateBinding Padding}"
  107. Foreground="{TemplateBinding Foreground}"
  108. Text="{TemplateBinding Content}"
  109. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  110. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  111. </Border>
  112. </ControlTemplate>
  113. </Setter.Value>
  114. </Setter>
  115. </Style>
  116. <!-- TextBlock -->
  117. <Style TargetType="TextBlock">
  118. <Setter Property="OverridesDefaultStyle" Value="True" />
  119. <Setter Property="FontSize" Value="13" />
  120. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  121. <Setter Property="TextTrimming" Value="CharacterEllipsis" />
  122. <Setter Property="FontFamily" Value="Resources/#PCL English, Microsoft YaHei UI" />
  123. </Style>
  124. <Style TargetType="TextBlock" x:Key="BasedOnTextBlock">
  125. <Setter Property="OverridesDefaultStyle" Value="True" />
  126. <Setter Property="FontSize" Value="13" />
  127. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  128. <Setter Property="TextTrimming" Value="CharacterEllipsis" />
  129. <Setter Property="FontFamily" Value="Resources/#PCL English, Microsoft YaHei UI" />
  130. </Style>
  131. <!-- ToolTip -->
  132. <Style TargetType="ToolTip">
  133. <Setter Property="Template">
  134. <Setter.Value>
  135. <ControlTemplate>
  136. <Border Loaded="TooltipLoaded" Unloaded="TooltipUnloaded" BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1.5" CornerRadius="4" MaxWidth="500" Background="#E5FFFFFF" Margin="0,0,4,4" SnapsToDevicePixels="True">
  137. <Border.Effect>
  138. <DropShadowEffect Opacity="0.3" BlurRadius="4" ShadowDepth="2" Color="{DynamicResource ColorObject1}" />
  139. </Border.Effect>
  140. <TextBlock Text="{TemplateBinding ContentControl.Content}" TextWrapping="Wrap" Foreground="{DynamicResource ColorBrush1}" Margin="7,5" FontSize="12"/>
  141. </Border>
  142. </ControlTemplate>
  143. </Setter.Value>
  144. </Setter>
  145. </Style>
  146. <Style x:Key="ExtendTextToolTip" TargetType="ToolTip">
  147. <Setter Property="Template">
  148. <Setter.Value>
  149. <ControlTemplate>
  150. <Border Loaded="TooltipLoaded" Unloaded="TooltipUnloaded" BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
  151. <TextBlock Text="{TemplateBinding ContentControl.Content}" TextWrapping="Wrap" Foreground="{DynamicResource ColorBrush1}" Margin="7,5" FontSize="12"/>
  152. </Border>
  153. </ControlTemplate>
  154. </Setter.Value>
  155. </Setter>
  156. </Style>
  157. <!-- ScrollViewer -->
  158. <Style x:Key="MyThumb" TargetType="Thumb">
  159. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  160. <Setter Property="Template">
  161. <Setter.Value>
  162. <ControlTemplate TargetType="Thumb">
  163. <Border Background="{StaticResource ColorBrushSemiTransparent}" SnapsToDevicePixels="True">
  164. <Border Background="{TemplateBinding Foreground}" CornerRadius="3" Margin="2" />
  165. </Border>
  166. </ControlTemplate>
  167. </Setter.Value>
  168. </Setter>
  169. </Style>
  170. <Style TargetType="local:MyScrollBar">
  171. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  172. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  173. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  174. <Setter Property="OverridesDefaultStyle" Value="True" />
  175. <Setter Property="SnapsToDevicePixels" Value="True" />
  176. <Setter Property="UseLayoutRounding" Value="True" />
  177. <Setter Property="MinWidth" Value="8"/>
  178. <Setter Property="Width" Value="8"/>
  179. <Setter Property="Template">
  180. <Setter.Value>
  181. <ControlTemplate TargetType="ScrollBar">
  182. <Border CornerRadius="2">
  183. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  184. <Track.Resources>
  185. <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
  186. 100
  187. </sys:Double>
  188. </Track.Resources>
  189. <Track.DecreaseRepeatButton>
  190. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Opacity="0" />
  191. </Track.DecreaseRepeatButton>
  192. <Track.IncreaseRepeatButton>
  193. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Opacity="0" />
  194. </Track.IncreaseRepeatButton> <!-- 不能删,删了点击 Thumb 以外的部分就不能翻页了 -->
  195. <Track.Thumb>
  196. <Thumb Style="{StaticResource MyThumb}" Foreground="{TemplateBinding Foreground}" />
  197. </Track.Thumb>
  198. </Track>
  199. </Border>
  200. </ControlTemplate>
  201. </Setter.Value>
  202. </Setter>
  203. </Style>
  204. <Style TargetType="local:MyScrollViewer">
  205. <Setter Property="OverridesDefaultStyle" Value="True" />
  206. <Setter Property="CanContentScroll" Value="False" />
  207. <Setter Property="PanningMode" Value="VerticalOnly" />
  208. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  209. <Setter Property="Template">
  210. <Setter.Value>
  211. <ControlTemplate TargetType="ScrollViewer">
  212. <Grid>
  213. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  214. <local:MyScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding Background}" HorizontalAlignment="Right" />
  215. </Grid>
  216. </ControlTemplate>
  217. </Setter.Value>
  218. </Setter>
  219. </Style>
  220. <Style TargetType="ScrollViewer" x:Key="ScrollViewerFullMargin">
  221. <Setter Property="OverridesDefaultStyle" Value="True" />
  222. <Setter Property="CanContentScroll" Value="False" />
  223. <Setter Property="PanningMode" Value="VerticalOnly" />
  224. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  225. <Setter Property="Template">
  226. <Setter.Value>
  227. <ControlTemplate TargetType="ScrollViewer">
  228. <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}">
  229. <Grid.ColumnDefinitions>
  230. <ColumnDefinition Width="*"/>
  231. <ColumnDefinition Width="Auto"/>
  232. </Grid.ColumnDefinitions>
  233. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"/>
  234. <local:MyScrollBar Margin="2,1,1,1" x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding Background}" />
  235. </Grid>
  236. </ControlTemplate>
  237. </Setter.Value>
  238. </Setter>
  239. </Style>
  240. <Style TargetType="ScrollViewer" x:Key="ScrollViewerNoMargin">
  241. <Setter Property="OverridesDefaultStyle" Value="True" />
  242. <Setter Property="CanContentScroll" Value="False" />
  243. <Setter Property="PanningMode" Value="VerticalOnly" />
  244. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  245. <Setter Property="Template">
  246. <Setter.Value>
  247. <ControlTemplate TargetType="ScrollViewer">
  248. <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Cursor="Arrow">
  249. <Grid.ColumnDefinitions>
  250. <ColumnDefinition Width="*"/>
  251. <ColumnDefinition Width="Auto"/>
  252. </Grid.ColumnDefinitions>
  253. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Cursor="{TemplateBinding Cursor}" />
  254. <local:MyScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Foreground="{TemplateBinding Foreground}" Background="{TemplateBinding Background}" />
  255. </Grid>
  256. </ControlTemplate>
  257. </Setter.Value>
  258. </Setter>
  259. </Style>
  260. <!-- TextBox -->
  261. <Style TargetType="local:MyTextBox">
  262. <Setter Property="BorderThickness" Value="1" />
  263. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  264. <Setter Property="FontSize" Value="13" />
  265. <Setter Property="SelectionBrush" Value="{DynamicResource ColorBrush3}" />
  266. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  267. <Setter Property="FontFamily" Value="Resources/#PCL English, Microsoft YaHei UI" />
  268. <Setter Property="VerticalContentAlignment" Value="Center" />
  269. <Setter Property="SnapsToDevicePixels" Value="True" />
  270. <Setter Property="IsUndoEnabled" Value="True" />
  271. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  272. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  273. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  274. <Setter Property="AllowDrop" Value="True"/>
  275. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  276. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  277. <Setter Property="UndoLimit" Value="15" />
  278. <Setter Property="MaxLength" Value="1000" />
  279. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrushBg0}" />
  280. <Setter Property="Template">
  281. <Setter.Value>
  282. <ControlTemplate TargetType="local:MyTextBox">
  283. <Grid SnapsToDevicePixels="True" ToolTip="{TemplateBinding ToolTip}">
  284. <Grid.RowDefinitions>
  285. <RowDefinition MinHeight="28" />
  286. <RowDefinition Height="Auto" />
  287. </Grid.RowDefinitions>
  288. <Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}">
  289. <ScrollViewer x:Name="PART_ContentHost" Style="{StaticResource ScrollViewerNoMargin}" RenderOptions.ClearTypeHint="Enabled" BorderThickness="0"
  290. Margin="5,0,0,0" Cursor="IBeam" />
  291. <!-- 由于未知原因,TextView 会有 2,0 的 Margin -->
  292. </Border>
  293. <Border Margin="{TemplateBinding Padding}" IsHitTestVisible="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" BorderThickness="0">
  294. <TextBlock x:Name="labHint" Foreground="{StaticResource ColorBrushGray4}" Margin="7,0,0,0" Padding="{TemplateBinding BorderThickness}" FontSize="{TemplateBinding FontSize}" FontFamily="Resources/#PCL English, Microsoft YaHei UI" />
  295. </Border>
  296. <TextBlock Grid.Row="1" x:Name="labWrong" Height="0" Foreground="{TemplateBinding BorderBrush}" Padding="0,4,0,0" Margin="0,0,0,-3" />
  297. </Grid>
  298. </ControlTemplate>
  299. </Setter.Value>
  300. </Setter>
  301. </Style>
  302. <Style TargetType="PasswordBox">
  303. <Setter Property="FontSize" Value="13" />
  304. <Setter Property="VerticalContentAlignment" Value="Top" />
  305. <Setter Property="SelectionBrush" Value="{DynamicResource ColorBrush3}" />
  306. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  307. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  308. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrushBg0}" />
  309. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  310. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  311. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  312. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  313. <Setter Property="Template">
  314. <Setter.Value>
  315. <ControlTemplate TargetType="PasswordBox">
  316. <Border x:Name="border" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="True" CornerRadius="3">
  317. <local:MyScrollViewer x:Name="PART_ContentHost" Margin="4.5,4.5,0,4.5" HorizontalScrollBarVisibility="Hidden" RenderOptions.ClearTypeHint="Enabled" SnapsToDevicePixels="True"/>
  318. </Border>
  319. <ControlTemplate.Triggers>
  320. <Trigger Property="IsEnabled" Value="False">
  321. <Trigger.Setters>
  322. <Setter Property="BorderBrush" Value="{StaticResource ColorBrushGray5}" />
  323. <Setter Property="Background" Value="{StaticResource ColorBrushGray6}" />
  324. </Trigger.Setters>
  325. </Trigger>
  326. <Trigger Property="IsMouseOver" Value="True">
  327. <Trigger.Setters>
  328. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrush4}" />
  329. <Setter Property="Background" Value="{DynamicResource ColorBrush7}" />
  330. </Trigger.Setters>
  331. </Trigger>
  332. <Trigger Property="IsFocused" Value="True">
  333. <Trigger.Setters>
  334. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrush3}" />
  335. <Setter Property="Background" Value="{DynamicResource ColorBrush7}" />
  336. </Trigger.Setters>
  337. </Trigger>
  338. </ControlTemplate.Triggers>
  339. </ControlTemplate>
  340. </Setter.Value>
  341. </Setter>
  342. </Style>
  343. <!-- ComboBox -->
  344. <DataTemplate x:Key="ComboBoxItemTemplateWithDelete">
  345. <local:MyListItem Title="{Binding}" FontSize="13" MaxHeight="26" IsScaleAnimationEnabled="False" Margin="-3,0,0,0">
  346. <local:MyListItem.Buttons>
  347. <x:Array Type="local:MyIconButton">
  348. <local:MyIconButton Grid.Column="1" Height="20" Width="20" VerticalAlignment="Center" Tag="{Binding}" Click="MyIconButton_Click" Logo="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z" />
  349. </x:Array>
  350. </local:MyListItem.Buttons>
  351. </local:MyListItem>
  352. </DataTemplate>
  353. <Style TargetType="local:MyComboBox">
  354. <Setter Property="OverridesDefaultStyle" Value="True" />
  355. <Setter Property="SnapsToDevicePixels" Value="True" />
  356. <Setter Property="Foreground" Value="{DynamicResource ColorBrushBg0}" />
  357. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  358. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  359. <Setter Property="FontSize" Value="13" />
  360. <Setter Property="MaxDropDownHeight" Value="160" />
  361. <Setter Property="Template">
  362. <Setter.Value>
  363. <ControlTemplate TargetType="ComboBox">
  364. <Grid>
  365. <Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="3" BorderThickness="1" BorderBrush="{TemplateBinding Foreground}" />
  366. <ToggleButton Margin="0,0,1.5,0" Foreground="{TemplateBinding Foreground}" IsTabStop="False" SnapsToDevicePixels="False" Focusable="False" IsChecked="{Binding IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" />
  367. <ContentPresenter x:Name="PART_Content" Margin="8.5,0,21.5,0" IsHitTestVisible="False" VerticalAlignment="Center"
  368. Content="{TemplateBinding SelectionBoxItem}"
  369. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  370. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" />
  371. <Popup x:Name="PART_Popup" SnapsToDevicePixels="True" VerticalOffset="-1.5" AllowsTransparency="True" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="Fade">
  372. <Grid x:Name="PanPopup">
  373. <Border Background="White" CornerRadius="3" />
  374. <Border x:Name="dropDownBorder" CornerRadius="3" BorderBrush="{TemplateBinding Foreground}" BorderThickness="1" Width="{TemplateBinding Width}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  375. <local:MyScrollViewer x:Name="DropDownScrollViewer" PanningMode="VerticalOnly" SnapsToDevicePixels="False" Style="{StaticResource ScrollViewerFullMargin}" ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto">
  376. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
  377. </local:MyScrollViewer>
  378. </Border>
  379. </Grid>
  380. </Popup>
  381. </Grid>
  382. <ControlTemplate.Triggers>
  383. <Trigger Property="HasItems" Value="false">
  384. <Setter Property="Height" TargetName="dropDownBorder" Value="26"/>
  385. </Trigger>
  386. </ControlTemplate.Triggers>
  387. </ControlTemplate>
  388. </Setter.Value>
  389. </Setter>
  390. <Style.Triggers>
  391. <Trigger Property="IsEditable" Value="True">
  392. <Setter Property="IsTabStop" Value="False"/>
  393. <Setter Property="ItemTemplate" Value="{StaticResource ComboBoxItemTemplateWithDelete}"/>
  394. <Setter Property="Template">
  395. <Setter.Value>
  396. <ControlTemplate TargetType="ComboBox">
  397. <Grid>
  398. <Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="3" BorderThickness="1" BorderBrush="{TemplateBinding Foreground}" />
  399. <ToggleButton Margin="0,0,1.5,0" Foreground="{TemplateBinding Foreground}" IsTabStop="False" SnapsToDevicePixels="False" Focusable="False" IsChecked="{Binding IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" />
  400. <local:MyTextBox x:Name="PART_EditableTextBox" BorderThickness="0" Margin="1.5,0,21.5,0" Padding="0" Background="{x:Null}" />
  401. <Popup x:Name="PART_Popup" SnapsToDevicePixels="True" VerticalOffset="-1.5" AllowsTransparency="True" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="Fade">
  402. <Grid x:Name="PanPopup">
  403. <Border Background="White" CornerRadius="3" />
  404. <Border x:Name="dropDownBorder" SnapsToDevicePixels="False" CornerRadius="3" BorderBrush="{TemplateBinding Foreground}" BorderThickness="1" Width="{TemplateBinding Width}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  405. <local:MyScrollViewer x:Name="DropDownScrollViewer" Style="{StaticResource ScrollViewerFullMargin}" ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto">
  406. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
  407. </local:MyScrollViewer>
  408. </Border>
  409. </Grid>
  410. </Popup>
  411. </Grid>
  412. <ControlTemplate.Triggers>
  413. <Trigger Property="HasItems" Value="false">
  414. <Setter Property="Height" TargetName="dropDownBorder" Value="26"/>
  415. </Trigger>
  416. </ControlTemplate.Triggers>
  417. </ControlTemplate>
  418. </Setter.Value>
  419. </Setter>
  420. </Trigger>
  421. </Style.Triggers>
  422. </Style>
  423. <Style TargetType="ToggleButton">
  424. <Setter Property="Template">
  425. <Setter.Value>
  426. <ControlTemplate TargetType="ToggleButton">
  427. <Border Background="{StaticResource ColorBrushSemiTransparent}">
  428. <Path x:Name="path" Width="15" RenderTransformOrigin="0.3,0.5" HorizontalAlignment="Right" Data="M1,1L4.5,4.5L8,1" StrokeThickness="1.5" Stroke="{TemplateBinding Foreground}" VerticalAlignment="Center">
  429. <Path.RenderTransform>
  430. <RotateTransform />
  431. </Path.RenderTransform>
  432. </Path>
  433. </Border>
  434. <ControlTemplate.Triggers>
  435. <Trigger Property="IsChecked" Value="True">
  436. <Trigger.EnterActions>
  437. <BeginStoryboard>
  438. <Storyboard Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  439. <DoubleAnimation To="180" Duration="0:0:0.2">
  440. <DoubleAnimation.EasingFunction>
  441. <CircleEase EasingMode="EaseOut" />
  442. </DoubleAnimation.EasingFunction>
  443. </DoubleAnimation>
  444. </Storyboard>
  445. </BeginStoryboard>
  446. </Trigger.EnterActions>
  447. <Trigger.ExitActions>
  448. <BeginStoryboard>
  449. <Storyboard Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  450. <DoubleAnimation To="0" Duration="0:0:0.2">
  451. <DoubleAnimation.EasingFunction>
  452. <CircleEase EasingMode="EaseOut" />
  453. </DoubleAnimation.EasingFunction>
  454. </DoubleAnimation>
  455. </Storyboard>
  456. </BeginStoryboard>
  457. </Trigger.ExitActions>
  458. </Trigger>
  459. </ControlTemplate.Triggers>
  460. </ControlTemplate>
  461. </Setter.Value>
  462. </Setter>
  463. </Style>
  464. <Style TargetType="ComboBoxItem" x:Key="MyComboBoxItem">
  465. <Setter Property="OverridesDefaultStyle" Value="True" />
  466. <Setter Property="ToolTipService.Placement" Value="Relative" />
  467. <Setter Property="ToolTipService.VerticalOffset" Value="-2" />
  468. <Setter Property="ToolTipService.HorizontalOffset" Value="200" />
  469. <Setter Property="ToolTipService.InitialShowDelay" Value="150" />
  470. <Setter Property="ToolTipService.BetweenShowDelay" Value="150" />
  471. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  472. <Setter Property="Background" Value="{StaticResource ColorBrushTransparent}" />
  473. <Setter Property="Template">
  474. <Setter.Value>
  475. <ControlTemplate TargetType="ComboBoxItem">
  476. <Border x:Name="ItemBorder" Padding="6,4" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
  477. <ContentPresenter />
  478. </Border>
  479. </ControlTemplate>
  480. </Setter.Value>
  481. </Setter>
  482. </Style>
  483. <Style TargetType="ComboBoxItem">
  484. <Setter Property="OverridesDefaultStyle" Value="True" />
  485. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  486. <Setter Property="Template">
  487. <Setter.Value>
  488. <ControlTemplate TargetType="ComboBoxItem">
  489. <Border x:Name="ItemBorder" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
  490. <ContentPresenter />
  491. </Border>
  492. </ControlTemplate>
  493. </Setter.Value>
  494. </Setter>
  495. </Style>
  496. <!-- ContextMenu -->
  497. <Style TargetType="ContextMenu">
  498. <Setter Property="SnapsToDevicePixels" Value="True"/>
  499. <Setter Property="OverridesDefaultStyle" Value="True"/>
  500. <Setter Property="Grid.IsSharedSizeScope" Value="True"/>
  501. <Setter Property="Focusable" Value="False"/>
  502. <Setter Property="HasDropShadow" Value="False"/>
  503. <Setter Property="Template">
  504. <Setter.Value>
  505. <ControlTemplate TargetType="ContextMenu">
  506. <Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
  507. <Border.Effect>
  508. <DropShadowEffect Opacity="0.4" BlurRadius="4" ShadowDepth="2" />
  509. </Border.Effect>
  510. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" Margin="0.5"/>
  511. </Border>
  512. </ControlTemplate>
  513. </Setter.Value>
  514. </Setter>
  515. </Style>
  516. <!-- MenuItem -->
  517. <Style TargetType="local:MyMenuItem">
  518. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  519. <Setter Property="Template">
  520. <Setter.Value>
  521. <ControlTemplate TargetType="MenuItem">
  522. <Border Name="PanBack" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Height="26">
  523. <Grid SnapsToDevicePixels="False" UseLayoutRounding="False">
  524. <Grid.ColumnDefinitions>
  525. <ColumnDefinition Width="Auto" SharedSizeGroup="Icon"/>
  526. <ColumnDefinition />
  527. <!-- <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
  528. <ColumnDefinition Width="13"/> -->
  529. </Grid.ColumnDefinitions>
  530. <Path Name="Icon" VerticalAlignment="Center" Stretch="Uniform" Margin="8,0" Fill="{TemplateBinding Foreground}" Height="12" Width="15" />
  531. <TextBlock Name="HeaderHost" Grid.Column="1" Text="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" Margin="0,0,40,0" VerticalAlignment="Center" Height="16" />
  532. <!-- <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,2,0,2" DockPanel.Dock="Right" /> -->
  533. </Grid>
  534. </Border>
  535. <ControlTemplate.Triggers>
  536. <Trigger Property="Icon" Value="{x:Null}">
  537. <Setter TargetName="Icon" Property="Visibility" Value="Hidden"/>
  538. </Trigger>
  539. </ControlTemplate.Triggers>
  540. </ControlTemplate>
  541. </Setter.Value>
  542. </Setter>
  543. </Style>
  544. </ResourceDictionary>
  545. </Application.Resources>
  546. </Application>