App.xaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <Application
  2. x:Class="ShakerManger.App"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:convert="clr-namespace:ShakerManger.Convert"
  6. xmlns:hc="https://handyorg.github.io/handycontrol"
  7. xmlns:local="clr-namespace:ShakerManger"
  8. xmlns:system="clr-namespace:System;assembly=mscorlib"
  9. xmlns:vm="clr-namespace:ShakerManger.ViewModel">
  10. <Application.Resources>
  11. <ResourceDictionary>
  12. <ResourceDictionary.MergedDictionaries>
  13. <ResourceDictionary Source="pack://application:,,,/AppResource;component/MangerResource.xaml" />
  14. <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml" />
  15. <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
  16. </ResourceDictionary.MergedDictionaries>
  17. <Style TargetType="ToolTip">
  18. <Setter Property="Template">
  19. <Setter.Value>
  20. <ControlTemplate>
  21. <StackPanel>
  22. <Path
  23. Margin="0,0,10,0"
  24. HorizontalAlignment="Right"
  25. VerticalAlignment="Center"
  26. Data="M 6 0 L 0 6 L 12 6 Z"
  27. Fill="#E6333333" />
  28. <Border
  29. HorizontalAlignment="Stretch"
  30. VerticalAlignment="Stretch"
  31. Background="#E6333333"
  32. CornerRadius="2">
  33. <TextBlock
  34. Margin="6"
  35. FontSize="12"
  36. Foreground="White"
  37. LineHeight="20"
  38. Text="{TemplateBinding ContentControl.Content}" />
  39. </Border>
  40. </StackPanel>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <vm:MainViewModelBindingProxy x:Key="MainViewModel" />
  46. <convert:MultiBoolConverter x:Key="MultiBoolConverter" />
  47. <convert:UserAllowClientIDConverter x:Key="UserAllowClientIDConverter" />
  48. <convert:Type2ViewConverter x:Key="Type2ViewConverter" />
  49. <convert:EnumToCollectionConverter x:Key="EnumToCollectionConverter" />
  50. <convert:OxyPlotColorToSolidBrushConverter x:Key="OxyPlotColorToSolidBrushConverter" />
  51. <vm:ColorPickerViewModel x:Key="ColorPicker" />
  52. <convert:EnumToDescription x:Key="EnumToDescription" />
  53. <convert:SilderDoubleConverter x:Key="SilderDoubleConverter" />
  54. <ControlTemplate x:Key="ComboBoxTemplate1" TargetType="ComboBox">
  55. <Grid>
  56. <Grid.ColumnDefinitions>
  57. <ColumnDefinition />
  58. <ColumnDefinition Width="Auto" />
  59. </Grid.ColumnDefinitions>
  60. <Border
  61. x:Name="border"
  62. Grid.ColumnSpan="2"
  63. Background="{TemplateBinding Background}"
  64. BorderBrush="{TemplateBinding BorderBrush}"
  65. BorderThickness="{TemplateBinding BorderThickness}"
  66. CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}" />
  67. <hc:ToggleBlock
  68. Grid.Column="1"
  69. Padding="1,0"
  70. HorizontalContentAlignment="Stretch"
  71. VerticalContentAlignment="Stretch"
  72. Background="Transparent"
  73. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
  74. <hc:ToggleBlock.UnCheckedContent>
  75. <Path
  76. Width="14"
  77. Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
  78. HorizontalAlignment="Right"
  79. VerticalAlignment="Center"
  80. Data="{StaticResource DownGeometry}"
  81. Fill="{TemplateBinding BorderBrush}"
  82. Stretch="Uniform" />
  83. </hc:ToggleBlock.UnCheckedContent>
  84. <hc:ToggleBlock.CheckedContent>
  85. <Path
  86. Width="14"
  87. Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
  88. HorizontalAlignment="Right"
  89. VerticalAlignment="Center"
  90. Data="{StaticResource UpGeometry}"
  91. Fill="{TemplateBinding BorderBrush}"
  92. Stretch="Uniform" />
  93. </hc:ToggleBlock.CheckedContent>
  94. </hc:ToggleBlock>
  95. <hc:ToggleBlock
  96. Grid.Column="0"
  97. Grid.ColumnSpan="2"
  98. HorizontalContentAlignment="Stretch"
  99. VerticalContentAlignment="Stretch"
  100. Background="Transparent"
  101. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  102. ToggleGesture="LeftClick" />
  103. <ContentPresenter
  104. x:Name="contentPresenter"
  105. Grid.Column="0"
  106. Margin="{TemplateBinding Padding}"
  107. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  108. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  109. Content="{TemplateBinding SelectionBoxItem}"
  110. ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
  111. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  112. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  113. IsHitTestVisible="false"
  114. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  115. <Popup
  116. x:Name="PART_Popup"
  117. Margin="1"
  118. AllowsTransparency="true"
  119. IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  120. Placement="Bottom"
  121. PlacementTarget="{Binding ElementName=border}"
  122. PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  123. <Decorator Margin="8,0">
  124. <Border
  125. x:Name="dropDownBorder"
  126. MinWidth="{Binding ActualWidth, ElementName=border}"
  127. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  128. Margin="0,0,0,8"
  129. Background="{StaticResource ComboBoxPopBackColor}"
  130. BorderBrush="{TemplateBinding BorderBrush}"
  131. BorderThickness="0,1,0,0"
  132. CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
  133. Effect="{StaticResource EffectShadow2}">
  134. <hc:ToggleBlock
  135. HorizontalContentAlignment="Stretch"
  136. VerticalContentAlignment="Stretch"
  137. IsChecked="{Binding HasItems, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
  138. <hc:ToggleBlock.CheckedContent>
  139. <ScrollViewer Margin="2">
  140. <ItemsPresenter
  141. x:Name="ItemsPresenter"
  142. KeyboardNavigation.DirectionalNavigation="Contained"
  143. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  144. </ScrollViewer>
  145. </hc:ToggleBlock.CheckedContent>
  146. <hc:ToggleBlock.UnCheckedContent>
  147. <hc:Empty />
  148. </hc:ToggleBlock.UnCheckedContent>
  149. </hc:ToggleBlock>
  150. </Border>
  151. </Decorator>
  152. </Popup>
  153. </Grid>
  154. <ControlTemplate.Triggers>
  155. <Trigger Property="HasItems" Value="false">
  156. <Setter TargetName="dropDownBorder" Property="Height" Value="95" />
  157. </Trigger>
  158. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  159. <Setter TargetName="dropDownBorder" Property="MaxWidth" Value="{Binding ActualWidth, ElementName=border}" />
  160. <Setter TargetName="dropDownBorder" Property="MinWidth" Value="{Binding ActualWidth, ElementName=border}" />
  161. </Trigger>
  162. <Trigger Property="hc:DropDownElement.AutoWidth" Value="True">
  163. <Setter TargetName="dropDownBorder" Property="MaxWidth" Value="{x:Static system:Double.MaxValue}" />
  164. <Setter TargetName="dropDownBorder" Property="MinWidth" Value="{Binding ActualHeight, ElementName=border}" />
  165. </Trigger>
  166. <MultiTrigger>
  167. <MultiTrigger.Conditions>
  168. <Condition Property="IsGrouping" Value="true" />
  169. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  170. </MultiTrigger.Conditions>
  171. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  172. </MultiTrigger>
  173. <MultiTrigger>
  174. <MultiTrigger.Conditions>
  175. <Condition Property="IsMouseOver" Value="true" />
  176. <Condition SourceName="PART_Popup" Property="IsOpen" Value="false" />
  177. </MultiTrigger.Conditions>
  178. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  179. </MultiTrigger>
  180. <Trigger SourceName="PART_Popup" Property="IsOpen" Value="True">
  181. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  182. </Trigger>
  183. <Trigger Property="IsFocused" Value="True">
  184. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  185. </Trigger>
  186. <Trigger Property="IsEnabled" Value="false">
  187. <Setter Property="Opacity" Value="0.4" />
  188. </Trigger>
  189. </ControlTemplate.Triggers>
  190. </ControlTemplate>
  191. <Style x:Key="ComboBoxItemBaseStyle1" TargetType="ComboBoxItem">
  192. <Setter Property="SnapsToDevicePixels" Value="True" />
  193. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
  194. <Setter Property="Background" Value="Transparent" />
  195. <Setter Property="BorderBrush" Value="Transparent" />
  196. <Setter Property="BorderThickness" Value="0" />
  197. <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
  198. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  199. <Setter Property="Template">
  200. <Setter.Value>
  201. <ControlTemplate TargetType="ComboBoxItem">
  202. <Border
  203. x:Name="Bd"
  204. Padding="{TemplateBinding Padding}"
  205. Background="{TemplateBinding Background}"
  206. BorderBrush="{TemplateBinding BorderBrush}"
  207. BorderThickness="{TemplateBinding BorderThickness}"
  208. CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
  209. Cursor="Hand">
  210. <ContentPresenter
  211. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  212. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  213. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  214. </Border>
  215. <ControlTemplate.Triggers>
  216. <MultiTrigger>
  217. <MultiTrigger.Conditions>
  218. <Condition Property="IsSelected" Value="False" />
  219. <Condition Property="IsMouseOver" Value="True" />
  220. </MultiTrigger.Conditions>
  221. <Setter TargetName="Bd" Property="Background" Value="Green" />
  222. </MultiTrigger>
  223. <MultiTrigger>
  224. <MultiTrigger.Conditions>
  225. <Condition Property="IsSelected" Value="True" />
  226. </MultiTrigger.Conditions>
  227. <Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryBrush}" />
  228. <Setter Property="Foreground" Value="White" />
  229. </MultiTrigger>
  230. </ControlTemplate.Triggers>
  231. </ControlTemplate>
  232. </Setter.Value>
  233. </Setter>
  234. </Style>
  235. <Style
  236. x:Key="ComboBoxStyle1"
  237. TargetType="{x:Type ComboBox}"
  238. BasedOn="{StaticResource InputElementBaseStyle}">
  239. <Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemBaseStyle1}" />
  240. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  241. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  242. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  243. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  244. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  245. <Setter Property="Cursor" Value="Hand" />
  246. <Setter Property="Template" Value="{StaticResource ComboBoxTemplate1}" />
  247. <Style.Triggers>
  248. <Trigger Property="IsEditable" Value="true">
  249. <Setter Property="IsTabStop" Value="false" />
  250. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
  251. </Trigger>
  252. </Style.Triggers>
  253. </Style>
  254. <Style TargetType="Button">
  255. <Setter Property="Template">
  256. <Setter.Value>
  257. <ControlTemplate TargetType="Button">
  258. <Border
  259. Background="{TemplateBinding Background}"
  260. BorderBrush="{TemplateBinding BorderBrush}"
  261. BorderThickness="{TemplateBinding BorderThickness}"
  262. CornerRadius="6">
  263. <Label
  264. Margin="0"
  265. Padding="0"
  266. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  267. VerticalAlignment="{TemplateBinding VerticalAlignment}"
  268. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  269. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  270. Background="Transparent"
  271. BorderBrush="Transparent"
  272. BorderThickness="0"
  273. Content="{TemplateBinding Content}"
  274. FontFamily="{TemplateBinding FontFamily}"
  275. FontSize="{TemplateBinding FontSize}"
  276. FontStretch="{TemplateBinding FontStretch}"
  277. FontWeight="{TemplateBinding FontWeight}"
  278. Foreground="{TemplateBinding Foreground}" />
  279. </Border>
  280. </ControlTemplate>
  281. </Setter.Value>
  282. </Setter>
  283. <Setter Property="Cursor" Value="Hand" />
  284. <Setter Property="Background" Value="{StaticResource ButtonBackColor}" />
  285. <Setter Property="Foreground" Value="{StaticResource NomalForeColor}" />
  286. <Setter Property="BorderBrush" Value="{StaticResource ButtonBorderColor}" />
  287. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  288. <Style.Triggers>
  289. <Trigger Property="IsFocused" Value="True">
  290. <Setter Property="Background" Value="{StaticResource ButtonBorderColor}" />
  291. </Trigger>
  292. <MultiTrigger>
  293. <MultiTrigger.Conditions>
  294. <Condition Property="IsMouseOver" Value="True" />
  295. <Condition Property="IsFocused" Value="True" />
  296. </MultiTrigger.Conditions>
  297. <Setter Property="Foreground" Value="{StaticResource ButtonFocusedColor}" />
  298. </MultiTrigger>
  299. <MultiTrigger>
  300. <MultiTrigger.Conditions>
  301. <Condition Property="IsMouseOver" Value="True" />
  302. <Condition Property="IsFocused" Value="False" />
  303. </MultiTrigger.Conditions>
  304. <Setter Property="Background" Value="{StaticResource ButtonBorderColor}" />
  305. </MultiTrigger>
  306. </Style.Triggers>
  307. </Style>
  308. <Style
  309. x:Key="ImageButton"
  310. TargetType="Button"
  311. BasedOn="{StaticResource ButtonIcon}">
  312. <Setter Property="Template">
  313. <Setter.Value>
  314. <ControlTemplate TargetType="Button">
  315. <Border Background="{TemplateBinding Background}">
  316. <Viewbox
  317. Width="{TemplateBinding hc:IconElement.Width}"
  318. Height="{TemplateBinding hc:IconElement.Height}"
  319. Cursor="Hand">
  320. <Path Data="{TemplateBinding hc:IconElement.Geometry}" Fill="{TemplateBinding Foreground}" />
  321. </Viewbox>
  322. </Border>
  323. </ControlTemplate>
  324. </Setter.Value>
  325. </Setter>
  326. <Setter Property="Cursor" Value="Hand" />
  327. <Setter Property="Foreground" Value="{StaticResource NomalForeColor}" />
  328. <Setter Property="BorderBrush" Value="Transparent" />
  329. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  330. <Style.Triggers>
  331. <Trigger Property="IsMouseOver" Value="True">
  332. <Setter Property="Foreground" Value="{StaticResource ButtonFocusedColor}" />
  333. </Trigger>
  334. </Style.Triggers>
  335. </Style>
  336. </ResourceDictionary>
  337. </Application.Resources>
  338. </Application>