Application.xaml 39 KB

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