App.xaml 21 KB

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