Application.xaml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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. <!-- ScrollViewer -->
  130. <Style x:Key="MyThumb" TargetType="Thumb">
  131. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
  132. <Setter Property="Template">
  133. <Setter.Value>
  134. <ControlTemplate TargetType="Thumb">
  135. <Border Background="{StaticResource ColorBrushSemiTransparent}" SnapsToDevicePixels="True">
  136. <Border Background="{TemplateBinding Foreground}" CornerRadius="3" Margin="2" />
  137. </Border>
  138. </ControlTemplate>
  139. </Setter.Value>
  140. </Setter>
  141. </Style>
  142. <Style TargetType="local:MyScrollBar">
  143. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  144. <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
  145. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  146. <Setter Property="OverridesDefaultStyle" Value="True" />
  147. <Setter Property="SnapsToDevicePixels" Value="True" />
  148. <Setter Property="UseLayoutRounding" Value="True" />
  149. <Setter Property="MinWidth" Value="8"/>
  150. <Setter Property="Width" Value="8"/>
  151. <Setter Property="Template">
  152. <Setter.Value>
  153. <ControlTemplate TargetType="ScrollBar">
  154. <Border CornerRadius="2">
  155. <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
  156. <Track.Resources>
  157. <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">
  158. 100
  159. </sys:Double>
  160. </Track.Resources>
  161. <Track.DecreaseRepeatButton>
  162. <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Opacity="0" />
  163. </Track.DecreaseRepeatButton>
  164. <Track.IncreaseRepeatButton>
  165. <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Opacity="0" />
  166. </Track.IncreaseRepeatButton> <!-- 不能删,删了点击 Thumb 以外的部分就不能翻页了 -->
  167. <Track.Thumb>
  168. <Thumb Style="{StaticResource MyThumb}" Foreground="{TemplateBinding Foreground}" />
  169. </Track.Thumb>
  170. </Track>
  171. </Border>
  172. </ControlTemplate>
  173. </Setter.Value>
  174. </Setter>
  175. </Style>
  176. <Style TargetType="local:MyScrollViewer" x:Name="StyleMyScrollViewer">
  177. <Setter Property="OverridesDefaultStyle" Value="True" />
  178. <Setter Property="CanContentScroll" Value="False" />
  179. <Setter Property="PanningMode" Value="VerticalOnly" />
  180. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  181. <Setter Property="Template">
  182. <Setter.Value>
  183. <ControlTemplate TargetType="ScrollViewer">
  184. <Grid>
  185. <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"/>
  186. <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" />
  187. </Grid>
  188. </ControlTemplate>
  189. </Setter.Value>
  190. </Setter>
  191. </Style>
  192. <Style TargetType="local:PageResource" BasedOn="{StaticResource {x:Type local:MyScrollViewer}}" />
  193. <Style TargetType="ScrollViewer" x:Key="ScrollViewerFullMargin">
  194. <Setter Property="OverridesDefaultStyle" Value="True" />
  195. <Setter Property="CanContentScroll" Value="False" />
  196. <Setter Property="PanningMode" Value="VerticalOnly" />
  197. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  198. <Setter Property="Template">
  199. <Setter.Value>
  200. <ControlTemplate TargetType="ScrollViewer">
  201. <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}">
  202. <Grid.ColumnDefinitions>
  203. <ColumnDefinition Width="*"/>
  204. <ColumnDefinition Width="Auto"/>
  205. </Grid.ColumnDefinitions>
  206. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"/>
  207. <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}" />
  208. </Grid>
  209. </ControlTemplate>
  210. </Setter.Value>
  211. </Setter>
  212. </Style>
  213. <Style TargetType="ScrollViewer" x:Key="ScrollViewerNoMargin">
  214. <Setter Property="OverridesDefaultStyle" Value="True" />
  215. <Setter Property="CanContentScroll" Value="False" />
  216. <Setter Property="PanningMode" Value="VerticalOnly" />
  217. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  218. <Setter Property="Template">
  219. <Setter.Value>
  220. <ControlTemplate TargetType="ScrollViewer">
  221. <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Cursor="Arrow">
  222. <Grid.ColumnDefinitions>
  223. <ColumnDefinition Width="*"/>
  224. <ColumnDefinition Width="Auto"/>
  225. </Grid.ColumnDefinitions>
  226. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Cursor="{TemplateBinding Cursor}" />
  227. <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}" />
  228. </Grid>
  229. </ControlTemplate>
  230. </Setter.Value>
  231. </Setter>
  232. </Style>
  233. <!-- TextBox -->
  234. <Style TargetType="local:MyTextBox">
  235. <Setter Property="BorderThickness" Value="1" />
  236. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  237. <Setter Property="FontSize" Value="13" />
  238. <Setter Property="SelectionBrush" Value="{DynamicResource ColorBrush3}" />
  239. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  240. <Setter Property="FontFamily" Value="Resources/#PCL English, Microsoft YaHei UI" />
  241. <Setter Property="VerticalContentAlignment" Value="Center" />
  242. <Setter Property="SnapsToDevicePixels" Value="True" />
  243. <Setter Property="IsUndoEnabled" Value="True" />
  244. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  245. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  246. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  247. <Setter Property="AllowDrop" Value="True"/>
  248. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  249. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  250. <Setter Property="UndoLimit" Value="15" />
  251. <Setter Property="MaxLength" Value="1000" />
  252. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrushBg0}" />
  253. <Setter Property="Template">
  254. <Setter.Value>
  255. <ControlTemplate TargetType="local:MyTextBox">
  256. <Grid SnapsToDevicePixels="True">
  257. <Grid.RowDefinitions>
  258. <RowDefinition MinHeight="28" />
  259. <RowDefinition Height="Auto" />
  260. </Grid.RowDefinitions>
  261. <Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}">
  262. <ScrollViewer x:Name="PART_ContentHost" Style="{StaticResource ScrollViewerNoMargin}" RenderOptions.ClearTypeHint="Enabled" BorderThickness="0"
  263. Margin="5,0,0,0" Cursor="IBeam" />
  264. <!-- 由于未知原因,TextView 会有 2,0 的 Margin -->
  265. </Border>
  266. <Border Margin="{TemplateBinding Padding}" IsHitTestVisible="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" BorderThickness="0">
  267. <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" />
  268. </Border>
  269. <TextBlock Grid.Row="1" x:Name="labWrong" Height="0" Foreground="{TemplateBinding BorderBrush}" Padding="0,4,0,0" Margin="0,0,0,-3" />
  270. </Grid>
  271. </ControlTemplate>
  272. </Setter.Value>
  273. </Setter>
  274. <Setter Property="behaviors:ClipboardInterceptor.EnableSafeClipboard" Value="True" />
  275. </Style>
  276. <Style TargetType="PasswordBox">
  277. <Setter Property="FontSize" Value="13" />
  278. <Setter Property="VerticalContentAlignment" Value="Top" />
  279. <Setter Property="SelectionBrush" Value="{DynamicResource ColorBrush3}" />
  280. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  281. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  282. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrushBg0}" />
  283. <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  284. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  285. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  286. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  287. <Setter Property="Template">
  288. <Setter.Value>
  289. <ControlTemplate TargetType="PasswordBox">
  290. <Border x:Name="border" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="0" SnapsToDevicePixels="True" CornerRadius="3">
  291. <local:MyScrollViewer x:Name="PART_ContentHost" Margin="4.5,4.5,0,4.5" HorizontalScrollBarVisibility="Hidden" RenderOptions.ClearTypeHint="Enabled" SnapsToDevicePixels="True"/>
  292. </Border>
  293. <ControlTemplate.Triggers>
  294. <Trigger Property="IsEnabled" Value="False">
  295. <Trigger.Setters>
  296. <Setter Property="BorderBrush" Value="{StaticResource ColorBrushGray5}" />
  297. <Setter Property="Background" Value="{StaticResource ColorBrushGray6}" />
  298. </Trigger.Setters>
  299. </Trigger>
  300. <Trigger Property="IsMouseOver" Value="True">
  301. <Trigger.Setters>
  302. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrush4}" />
  303. <Setter Property="Background" Value="{DynamicResource ColorBrush7}" />
  304. </Trigger.Setters>
  305. </Trigger>
  306. <Trigger Property="IsFocused" Value="True">
  307. <Trigger.Setters>
  308. <Setter Property="BorderBrush" Value="{DynamicResource ColorBrush3}" />
  309. <Setter Property="Background" Value="{DynamicResource ColorBrush7}" />
  310. </Trigger.Setters>
  311. </Trigger>
  312. </ControlTemplate.Triggers>
  313. </ControlTemplate>
  314. </Setter.Value>
  315. </Setter>
  316. <Setter Property="behaviors:ClipboardInterceptor.EnableSafeClipboard" Value="True" />
  317. </Style>
  318. <!-- ComboBox -->
  319. <DataTemplate x:Key="ComboBoxItemTemplateWithDelete">
  320. <local:MyListItem Title="{Binding}" FontSize="13" MaxHeight="26" IsScaleAnimationEnabled="False" Margin="-3,0,0,0">
  321. <local:MyListItem.Buttons>
  322. <x:Array Type="local:MyIconButton">
  323. <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" />
  324. </x:Array>
  325. </local:MyListItem.Buttons>
  326. </local:MyListItem>
  327. </DataTemplate>
  328. <Style TargetType="local:MyComboBox">
  329. <Setter Property="OverridesDefaultStyle" Value="True" />
  330. <Setter Property="SnapsToDevicePixels" Value="True" />
  331. <Setter Property="Foreground" Value="{DynamicResource ColorBrushBg0}" />
  332. <Setter Property="Background" Value="{StaticResource ColorBrushHalfWhite}" />
  333. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  334. <Setter Property="FontSize" Value="13" />
  335. <Setter Property="MaxDropDownHeight" Value="320" />
  336. <Setter Property="Template">
  337. <Setter.Value>
  338. <ControlTemplate TargetType="ComboBox">
  339. <Grid>
  340. <Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="3" BorderThickness="1" BorderBrush="{TemplateBinding Foreground}" />
  341. <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" />
  342. <ContentPresenter x:Name="PART_Content" Margin="8.5,0,21.5,0" IsHitTestVisible="False" VerticalAlignment="Center"
  343. Content="{TemplateBinding SelectionBoxItem}"
  344. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  345. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" />
  346. <Popup x:Name="PART_Popup" SnapsToDevicePixels="True" VerticalOffset="-1.5" AllowsTransparency="True" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="Fade">
  347. <Grid x:Name="PanPopup">
  348. <Border Background="White" CornerRadius="3" />
  349. <Border x:Name="dropDownBorder" CornerRadius="3" BorderBrush="{TemplateBinding Foreground}" BorderThickness="1" Width="{TemplateBinding Width}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  350. <local:MyScrollViewer x:Name="DropDownScrollViewer" PanningMode="VerticalOnly" SnapsToDevicePixels="False" Style="{StaticResource ScrollViewerFullMargin}" ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto">
  351. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
  352. </local:MyScrollViewer>
  353. </Border>
  354. </Grid>
  355. </Popup>
  356. </Grid>
  357. <ControlTemplate.Triggers>
  358. <Trigger Property="HasItems" Value="false">
  359. <Setter Property="Height" TargetName="dropDownBorder" Value="26"/>
  360. </Trigger>
  361. </ControlTemplate.Triggers>
  362. </ControlTemplate>
  363. </Setter.Value>
  364. </Setter>
  365. <Style.Triggers>
  366. <Trigger Property="IsEditable" Value="True">
  367. <Setter Property="IsTabStop" Value="False"/>
  368. <Setter Property="ItemTemplate" Value="{StaticResource ComboBoxItemTemplateWithDelete}"/>
  369. <Setter Property="Template">
  370. <Setter.Value>
  371. <ControlTemplate TargetType="ComboBox">
  372. <Grid>
  373. <Border x:Name="border" Background="{TemplateBinding Background}" CornerRadius="3" BorderThickness="1" BorderBrush="{TemplateBinding Foreground}" />
  374. <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" />
  375. <local:MyTextBox x:Name="PART_EditableTextBox" BorderThickness="0" Margin="1.5,0,21.5,0" Padding="0" Background="{x:Null}" />
  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" SnapsToDevicePixels="False" CornerRadius="3" BorderBrush="{TemplateBinding Foreground}" BorderThickness="1" Width="{TemplateBinding Width}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  380. <local:MyScrollViewer x:Name="DropDownScrollViewer" 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. </Trigger>
  396. </Style.Triggers>
  397. </Style>
  398. <Style TargetType="ToggleButton">
  399. <Setter Property="Template">
  400. <Setter.Value>
  401. <ControlTemplate TargetType="ToggleButton">
  402. <Border Background="{StaticResource ColorBrushSemiTransparent}">
  403. <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">
  404. <Path.RenderTransform>
  405. <RotateTransform />
  406. </Path.RenderTransform>
  407. </Path>
  408. </Border>
  409. <ControlTemplate.Triggers>
  410. <Trigger Property="IsChecked" Value="True">
  411. <Trigger.EnterActions>
  412. <BeginStoryboard>
  413. <Storyboard Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  414. <DoubleAnimation To="180" Duration="0:0:0.2">
  415. <DoubleAnimation.EasingFunction>
  416. <CircleEase EasingMode="EaseOut" />
  417. </DoubleAnimation.EasingFunction>
  418. </DoubleAnimation>
  419. </Storyboard>
  420. </BeginStoryboard>
  421. </Trigger.EnterActions>
  422. <Trigger.ExitActions>
  423. <BeginStoryboard>
  424. <Storyboard Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  425. <DoubleAnimation To="0" Duration="0:0:0.2">
  426. <DoubleAnimation.EasingFunction>
  427. <CircleEase EasingMode="EaseOut" />
  428. </DoubleAnimation.EasingFunction>
  429. </DoubleAnimation>
  430. </Storyboard>
  431. </BeginStoryboard>
  432. </Trigger.ExitActions>
  433. </Trigger>
  434. </ControlTemplate.Triggers>
  435. </ControlTemplate>
  436. </Setter.Value>
  437. </Setter>
  438. </Style>
  439. <Style TargetType="ComboBoxItem" x:Key="MyComboBoxItem">
  440. <Setter Property="OverridesDefaultStyle" Value="True" />
  441. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  442. <Setter Property="Background" Value="{StaticResource ColorBrushTransparent}" />
  443. <Setter Property="Template">
  444. <Setter.Value>
  445. <ControlTemplate TargetType="ComboBoxItem">
  446. <Border x:Name="ItemBorder" Padding="6,4" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
  447. <ContentPresenter />
  448. </Border>
  449. </ControlTemplate>
  450. </Setter.Value>
  451. </Setter>
  452. </Style>
  453. <Style TargetType="ComboBoxItem">
  454. <Setter Property="OverridesDefaultStyle" Value="True" />
  455. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  456. <Setter Property="Template">
  457. <Setter.Value>
  458. <ControlTemplate TargetType="ComboBoxItem">
  459. <Border x:Name="ItemBorder" SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
  460. <ContentPresenter />
  461. </Border>
  462. </ControlTemplate>
  463. </Setter.Value>
  464. </Setter>
  465. </Style>
  466. <!-- ContextMenu -->
  467. <Style TargetType="ContextMenu">
  468. <Setter Property="SnapsToDevicePixels" Value="True"/>
  469. <Setter Property="OverridesDefaultStyle" Value="True"/>
  470. <Setter Property="Grid.IsSharedSizeScope" Value="True"/>
  471. <Setter Property="Focusable" Value="False"/>
  472. <Setter Property="HasDropShadow" Value="False"/>
  473. <Setter Property="Template">
  474. <Setter.Value>
  475. <ControlTemplate TargetType="ContextMenu">
  476. <Border BorderBrush="{DynamicResource ColorBrush1}" BorderThickness="1" CornerRadius="3" Background="White" Margin="0,0,4,4" SnapsToDevicePixels="True">
  477. <Border.Effect>
  478. <DropShadowEffect Opacity="0.4" BlurRadius="4" ShadowDepth="2" />
  479. </Border.Effect>
  480. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" Margin="0.5"/>
  481. </Border>
  482. </ControlTemplate>
  483. </Setter.Value>
  484. </Setter>
  485. </Style>
  486. <!-- MenuItem -->
  487. <Style TargetType="local:MyMenuItem">
  488. <Setter Property="Foreground" Value="{DynamicResource ColorBrush1}" />
  489. <Setter Property="Template">
  490. <Setter.Value>
  491. <ControlTemplate TargetType="MenuItem">
  492. <Border Name="PanBack" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Height="26">
  493. <Grid SnapsToDevicePixels="False" UseLayoutRounding="False">
  494. <Grid.ColumnDefinitions>
  495. <ColumnDefinition Width="Auto" SharedSizeGroup="Icon"/>
  496. <ColumnDefinition />
  497. <!-- <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
  498. <ColumnDefinition Width="13"/> -->
  499. </Grid.ColumnDefinitions>
  500. <Path Name="Icon" VerticalAlignment="Center" Stretch="Uniform" Margin="8,0" Fill="{TemplateBinding Foreground}" Height="12" Width="15" />
  501. <TextBlock Name="HeaderHost" Grid.Column="1" Text="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" Margin="0,0,40,0" VerticalAlignment="Center" Height="16" />
  502. <!-- <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,2,0,2" DockPanel.Dock="Right" /> -->
  503. </Grid>
  504. </Border>
  505. <ControlTemplate.Triggers>
  506. <Trigger Property="Icon" Value="{x:Null}">
  507. <Setter TargetName="Icon" Property="Visibility" Value="Hidden"/>
  508. </Trigger>
  509. </ControlTemplate.Triggers>
  510. </ControlTemplate>
  511. </Setter.Value>
  512. </Setter>
  513. </Style>
  514. </ResourceDictionary>
  515. </Application.Resources>
  516. </Application>