Application.xaml 39 KB

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