Generic.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:ZUI="clr-namespace:CustomUI">
  5. <SolidColorBrush x:Key="Item.MouseOver.Background" Color="#F3F3F3" />
  6. <SolidColorBrush x:Key="Item.MouseOver.Border" Color="#a826A0Da" />
  7. <SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#3DDADADA" />
  8. <SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FFDADADA" />
  9. <SolidColorBrush x:Key="Item.SelectedActive.Background" Color="#3D26A0DA" />
  10. <SolidColorBrush x:Key="Item.SelectedActive.Border" Color="#FF26A0DA" />
  11. <Style TargetType="{x:Type ZUI:Heading}">
  12. <Setter Property="Foreground" Value="#000000" />
  13. <Setter Property="FontSize" Value="14" />
  14. </Style>
  15. <!--#region 左边样式-->
  16. <Style x:Key="LeftIndicatorStyle" TargetType="{x:Type ZUI:SegmentControl}">
  17. <Setter Property="Padding" Value="0" />
  18. <Setter Property="CornerRadius" Value="0" />
  19. <Setter Property="VerticalAlignment" Value="Top" />
  20. <Setter Property="BorderThickness" Value="0,0,1,0" />
  21. <Setter Property="BorderBrush" Value="#D7DDE4" />
  22. <Setter Property="VerticalAlignment" Value="Stretch" />
  23. <Setter Property="ItemsPanel">
  24. <Setter.Value>
  25. <ItemsPanelTemplate>
  26. <StackPanel IsItemsHost="True" Orientation="Vertical" />
  27. </ItemsPanelTemplate>
  28. </Setter.Value>
  29. </Setter>
  30. </Style>
  31. <Style x:Key="LeftIndicatorItemStyle" TargetType="{x:Type ZUI:SegmentItem}">
  32. <Setter Property="Padding" Value="0" />
  33. <Setter Property="BorderThickness" Value="0" />
  34. <Setter Property="Background" Value="Transparent" />
  35. <Setter Property="HorizontalContentAlignment" Value="Right" />
  36. <Setter Property="Template">
  37. <Setter.Value>
  38. <ControlTemplate TargetType="{x:Type ZUI:SegmentItem}">
  39. <Border
  40. x:Name="Bd"
  41. Padding="{TemplateBinding Padding}"
  42. Background="{TemplateBinding Background}"
  43. BorderBrush="{TemplateBinding BorderBrush}"
  44. BorderThickness="{TemplateBinding BorderThickness}"
  45. SnapsToDevicePixels="true"
  46. UseLayoutRounding="True">
  47. <Grid>
  48. <Grid.ColumnDefinitions>
  49. <ColumnDefinition />
  50. <ColumnDefinition Width="3" />
  51. </Grid.ColumnDefinitions>
  52. <ContentPresenter
  53. Margin="20,8,20,8"
  54. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  55. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  56. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  57. <Border
  58. x:Name="markline"
  59. Grid.Column="1"
  60. Background="#003399FF"
  61. SnapsToDevicePixels="True"
  62. UseLayoutRounding="True" />
  63. </Grid>
  64. </Border>
  65. <ControlTemplate.Triggers>
  66. <Trigger Property="IsMouseOver" Value="True">
  67. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  68. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
  69. </Trigger>
  70. <MultiTrigger>
  71. <MultiTrigger.Conditions>
  72. <Condition Property="IsMouseOver" Value="True" />
  73. <Condition Property="IsSelected" Value="True" />
  74. </MultiTrigger.Conditions>
  75. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  76. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
  77. </MultiTrigger>
  78. <MultiTrigger>
  79. <MultiTrigger.Conditions>
  80. <Condition Property="Selector.IsSelectionActive" Value="False" />
  81. <Condition Property="IsSelected" Value="True" />
  82. </MultiTrigger.Conditions>
  83. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  84. <Setter TargetName="markline" Property="Background" Value="#3399FF" />
  85. </MultiTrigger>
  86. <MultiTrigger>
  87. <MultiTrigger.Conditions>
  88. <Condition Property="Selector.IsSelectionActive" Value="True" />
  89. <Condition Property="IsSelected" Value="True" />
  90. </MultiTrigger.Conditions>
  91. <Setter TargetName="markline" Property="Background" Value="#3399FF" />
  92. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  93. <Setter Property="Foreground" Value="#3399FF" />
  94. </MultiTrigger>
  95. <Trigger Property="IsEnabled" Value="False">
  96. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  97. </Trigger>
  98. </ControlTemplate.Triggers>
  99. </ControlTemplate>
  100. </Setter.Value>
  101. </Setter>
  102. </Style>
  103. <!--#endregion-->
  104. <!--#region 右边样式-->
  105. <Style x:Key="RightIndicatorStyle" TargetType="{x:Type ZUI:SegmentControl}">
  106. <Setter Property="Padding" Value="0" />
  107. <Setter Property="CornerRadius" Value="0" />
  108. <Setter Property="VerticalAlignment" Value="Top" />
  109. <Setter Property="BorderThickness" Value="1,0,0,0" />
  110. <Setter Property="BorderBrush" Value="#D7DDE4" />
  111. <Setter Property="VerticalAlignment" Value="Stretch" />
  112. <Setter Property="ItemsPanel">
  113. <Setter.Value>
  114. <ItemsPanelTemplate>
  115. <StackPanel IsItemsHost="True" Orientation="Vertical" />
  116. </ItemsPanelTemplate>
  117. </Setter.Value>
  118. </Setter>
  119. </Style>
  120. <Style x:Key="RightIndicatorItemStyle" TargetType="{x:Type ZUI:SegmentItem}">
  121. <Setter Property="Padding" Value="0" />
  122. <Setter Property="BorderThickness" Value="0" />
  123. <Setter Property="Background" Value="Transparent" />
  124. <Setter Property="HorizontalContentAlignment" Value="Left" />
  125. <Setter Property="Template">
  126. <Setter.Value>
  127. <ControlTemplate TargetType="{x:Type ZUI:SegmentItem}">
  128. <Border
  129. x:Name="Bd"
  130. Padding="{TemplateBinding Padding}"
  131. Background="{TemplateBinding Background}"
  132. BorderBrush="{TemplateBinding BorderBrush}"
  133. BorderThickness="{TemplateBinding BorderThickness}"
  134. SnapsToDevicePixels="true"
  135. UseLayoutRounding="True">
  136. <Grid>
  137. <Grid.ColumnDefinitions>
  138. <ColumnDefinition Width="3" />
  139. <ColumnDefinition />
  140. </Grid.ColumnDefinitions>
  141. <ContentPresenter
  142. Grid.Column="1"
  143. Margin="20,8,20,8"
  144. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  145. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  146. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  147. <Border
  148. x:Name="markline"
  149. Grid.Column="0"
  150. Background="#003399FF"
  151. SnapsToDevicePixels="True"
  152. UseLayoutRounding="True" />
  153. </Grid>
  154. </Border>
  155. <ControlTemplate.Triggers>
  156. <Trigger Property="IsMouseOver" Value="True">
  157. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  158. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
  159. </Trigger>
  160. <MultiTrigger>
  161. <MultiTrigger.Conditions>
  162. <Condition Property="IsMouseOver" Value="True" />
  163. <Condition Property="IsSelected" Value="True" />
  164. </MultiTrigger.Conditions>
  165. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  166. <Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource Item.MouseOver.Border}" />
  167. </MultiTrigger>
  168. <MultiTrigger>
  169. <MultiTrigger.Conditions>
  170. <Condition Property="Selector.IsSelectionActive" Value="False" />
  171. <Condition Property="IsSelected" Value="True" />
  172. </MultiTrigger.Conditions>
  173. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  174. <Setter TargetName="markline" Property="Background" Value="#3399FF" />
  175. </MultiTrigger>
  176. <MultiTrigger>
  177. <MultiTrigger.Conditions>
  178. <Condition Property="Selector.IsSelectionActive" Value="True" />
  179. <Condition Property="IsSelected" Value="True" />
  180. </MultiTrigger.Conditions>
  181. <Setter TargetName="markline" Property="Background" Value="#3399FF" />
  182. <Setter TargetName="Bd" Property="Background" Value="{StaticResource Item.MouseOver.Background}" />
  183. <Setter Property="Foreground" Value="#3399FF" />
  184. </MultiTrigger>
  185. <Trigger Property="IsEnabled" Value="False">
  186. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  187. </Trigger>
  188. </ControlTemplate.Triggers>
  189. </ControlTemplate>
  190. </Setter.Value>
  191. </Setter>
  192. </Style>
  193. <!--#endregion-->
  194. <!--#region 索引器在左边-->
  195. <ControlTemplate x:Key="IndicatorIsInLeft" TargetType="{x:Type ZUI:NavigationPanel}">
  196. <Grid>
  197. <Grid.ColumnDefinitions>
  198. <ColumnDefinition Width="auto" />
  199. <ColumnDefinition Width="*" />
  200. </Grid.ColumnDefinitions>
  201. <ZUI:SegmentControl
  202. x:Name="PART_Indicator"
  203. Margin="{TemplateBinding IndicatorMargin}"
  204. HorizontalAlignment="{TemplateBinding IndicatorHorizontalAlignment}"
  205. DisplayMemberPath="Header"
  206. ItemContainerStyle="{TemplateBinding IndicatorItemContainerStyle}"
  207. ItemsSource="{TemplateBinding ItemsSource}"
  208. SelectedIndex="0"
  209. Style="{TemplateBinding IndicatorStyle}" />
  210. <ContentPresenter
  211. x:Name="PART_ContentPresenter"
  212. Grid.Column="1"
  213. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  214. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  215. </Grid>
  216. </ControlTemplate>
  217. <!--#endregion-->
  218. <!--#region 索引器在顶部-->
  219. <ControlTemplate x:Key="IndicatorIsInTop" TargetType="{x:Type ZUI:NavigationPanel}">
  220. <Grid>
  221. <Grid.RowDefinitions>
  222. <RowDefinition Height="auto" />
  223. <RowDefinition Height="*" />
  224. </Grid.RowDefinitions>
  225. <ZUI:SegmentControl
  226. x:Name="PART_Indicator"
  227. Margin="{TemplateBinding IndicatorMargin}"
  228. HorizontalAlignment="{TemplateBinding IndicatorHorizontalAlignment}"
  229. DisplayMemberPath="Header"
  230. ItemContainerStyle="{TemplateBinding IndicatorItemContainerStyle}"
  231. ItemsSource="{TemplateBinding ItemsSource}"
  232. SelectedIndex="0"
  233. Style="{TemplateBinding IndicatorStyle}" />
  234. <ContentPresenter
  235. x:Name="PART_ContentPresenter"
  236. Grid.Row="1"
  237. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  238. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  239. </Grid>
  240. </ControlTemplate>
  241. <!--#endregion-->
  242. <!--#region 索引器在右边-->
  243. <ControlTemplate x:Key="IndicatorIsInRight" TargetType="{x:Type ZUI:NavigationPanel}">
  244. <Grid>
  245. <Grid.ColumnDefinitions>
  246. <ColumnDefinition Width="*" />
  247. <ColumnDefinition Width="auto" />
  248. </Grid.ColumnDefinitions>
  249. <ZUI:SegmentControl
  250. x:Name="PART_Indicator"
  251. Grid.Column="1"
  252. Margin="{TemplateBinding IndicatorMargin}"
  253. HorizontalAlignment="{TemplateBinding IndicatorHorizontalAlignment}"
  254. DisplayMemberPath="Header"
  255. ItemContainerStyle="{TemplateBinding IndicatorItemContainerStyle}"
  256. ItemsSource="{TemplateBinding ItemsSource}"
  257. SelectedIndex="0"
  258. Style="{TemplateBinding IndicatorStyle}" />
  259. <ContentPresenter
  260. x:Name="PART_ContentPresenter"
  261. Grid.Column="0"
  262. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  263. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  264. </Grid>
  265. </ControlTemplate>
  266. <!--#endregion-->
  267. <!--#region 索引器在底部-->
  268. <ControlTemplate x:Key="IndicatorIsInBottom" TargetType="{x:Type ZUI:NavigationPanel}">
  269. <Grid>
  270. <Grid.RowDefinitions>
  271. <RowDefinition Height="*" />
  272. <RowDefinition Height="auto" />
  273. </Grid.RowDefinitions>
  274. <ZUI:SegmentControl
  275. x:Name="PART_Indicator"
  276. Grid.Row="1"
  277. Margin="{TemplateBinding IndicatorMargin}"
  278. HorizontalAlignment="{TemplateBinding IndicatorHorizontalAlignment}"
  279. DisplayMemberPath="Header"
  280. ItemContainerStyle="{TemplateBinding IndicatorItemContainerStyle}"
  281. ItemsSource="{TemplateBinding ItemsSource}"
  282. SelectedIndex="0"
  283. Style="{TemplateBinding IndicatorStyle}" />
  284. <ContentPresenter
  285. x:Name="PART_ContentPresenter"
  286. Grid.Row="0"
  287. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  288. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  289. </Grid>
  290. </ControlTemplate>
  291. <!--#endregion-->
  292. <Style TargetType="{x:Type ZUI:NavigationPanel}">
  293. <Setter Property="Background" Value="Transparent" />
  294. <Setter Property="BorderBrush" Value="Transparent" />
  295. <Setter Property="BorderThickness" Value="1" />
  296. <Setter Property="Foreground" Value="Black" />
  297. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  298. <Setter Property="VerticalContentAlignment" Value="Center" />
  299. <Setter Property="SnapsToDevicePixels" Value="True" />
  300. <Setter Property="UseLayoutRounding" Value="True" />
  301. <Setter Property="Template" Value="{StaticResource IndicatorIsInTop}" />
  302. <Style.Triggers>
  303. <Trigger Property="IndicatorPlacement" Value="Left">
  304. <Setter Property="Template" Value="{StaticResource IndicatorIsInLeft}" />
  305. <Setter Property="IndicatorItemContainerStyle" Value="{StaticResource LeftIndicatorItemStyle}" />
  306. <Setter Property="IndicatorStyle" Value="{StaticResource LeftIndicatorStyle}" />
  307. </Trigger>
  308. <Trigger Property="IndicatorPlacement" Value="Right">
  309. <Setter Property="Template" Value="{StaticResource IndicatorIsInRight}" />
  310. <Setter Property="IndicatorItemContainerStyle" Value="{StaticResource RightIndicatorItemStyle}" />
  311. <Setter Property="IndicatorStyle" Value="{StaticResource RightIndicatorStyle}" />
  312. </Trigger>
  313. <Trigger Property="IndicatorPlacement" Value="Bottom">
  314. <Setter Property="Template" Value="{StaticResource IndicatorIsInBottom}" />
  315. </Trigger>
  316. </Style.Triggers>
  317. </Style>
  318. </ResourceDictionary>