Application.xaml 38 KB

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