TabControlStyle.xaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. >
  4. <!--通用TabControl样式-->
  5. <Style TargetType="{x:Type TabControl}" x:Key="LargeTab">
  6. <!--<Setter Property="Background" Value="#FFC5D0D8"/>-->
  7. <Setter Property="Background" Value="#669ACC"/>
  8. <Setter Property="FontFamily" Value="Arial,SimSun"/>
  9. </Style>
  10. <!--通用TabItem样式-->
  11. <Style TargetType="TabItem">
  12. <Setter Property="FrameworkElement.FocusVisualStyle">
  13. <Setter.Value>
  14. <Style TargetType="Control">
  15. <Style.Resources>
  16. <ResourceDictionary />
  17. </Style.Resources>
  18. <Setter Property="Control.Template">
  19. <Setter.Value>
  20. <ControlTemplate>
  21. <Border>
  22. <Rectangle StrokeThickness="0" />
  23. </Border>
  24. </ControlTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. </Setter.Value>
  29. </Setter>
  30. </Style>
  31. <!--通用TabControl样式-->
  32. <Style TargetType="{x:Type TabControl}" >
  33. <!--<Setter Property="Background" Value="#FFC5D0D8"/>-->
  34. <Setter Property="Background" Value="#669ACC"/>
  35. <Setter Property="FontFamily" Value="Arial,SimSun"/>
  36. <Setter Property="FontSize" Value="17"></Setter>
  37. <Setter Property="ItemContainerStyle">
  38. <Setter.Value>
  39. <Style>
  40. <Setter Property="Control.Height" Value="24"></Setter>
  41. <Setter Property="Control.Template">
  42. <Setter.Value>
  43. <ControlTemplate TargetType="{x:Type TabItem}">
  44. <Grid Margin="0 0 -10 0">
  45. <Path Data="M190 0 L 0 0 L 10 23 L 170 23 L 190 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  46. Stroke="Black">
  47. </Path>
  48. <ContentPresenter Margin="10 3 10 0" ContentSource="Header" Cursor="Hand" />
  49. </Grid>
  50. <ControlTemplate.Triggers>
  51. <Trigger Property="IsSelected" Value="True">
  52. <Trigger.Setters>
  53. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  54. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  55. </Trigger.Setters>
  56. </Trigger>
  57. <Trigger Property="IsSelected" Value="False">
  58. <Trigger.Setters>
  59. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  60. </Trigger.Setters>
  61. </Trigger>
  62. </ControlTemplate.Triggers>
  63. </ControlTemplate>
  64. </Setter.Value>
  65. </Setter>
  66. </Style>
  67. </Setter.Value>
  68. </Setter>
  69. <Setter Property="Template">
  70. <Setter.Value>
  71. <ControlTemplate TargetType="{x:Type TabControl}">
  72. <Grid ClipToBounds="True" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True">
  73. <Grid.ColumnDefinitions>
  74. <ColumnDefinition Name="ColumnDefinition0" Width="*"/>
  75. </Grid.ColumnDefinitions>
  76. <Grid.RowDefinitions>
  77. <RowDefinition Name="RowDefinition0" />
  78. <RowDefinition Name="RowDefinition1" Height="25"/>
  79. </Grid.RowDefinitions>
  80. <StackPanel Name="HeaderPanel"
  81. Orientation="Horizontal"
  82. Grid.Row="1"
  83. Background="#40a8c4"
  84. Margin="0,0,0,0"
  85. Panel.ZIndex="1"
  86. IsItemsHost="True"
  87. KeyboardNavigation.TabIndex="1"/>
  88. <Border Name="ContentPanel"
  89. Grid.Row="0"
  90. Background="{TemplateBinding Panel.Background}"
  91. BorderBrush="{TemplateBinding Border.BorderBrush}"
  92. BorderThickness="{TemplateBinding Border.BorderThickness}"
  93. KeyboardNavigation.DirectionalNavigation="Contained"
  94. KeyboardNavigation.TabIndex="2"
  95. KeyboardNavigation.TabNavigation="Local">
  96. <ContentPresenter Name="PART_SelectedContentHost"
  97. Margin="{TemplateBinding Control.Padding}"
  98. Content="{TemplateBinding TabControl.SelectedContent}"
  99. ContentSource="SelectedContent"
  100. ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}"
  101. ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
  102. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
  103. </Border>
  104. </Grid>
  105. </ControlTemplate>
  106. </Setter.Value>
  107. </Setter>
  108. </Style>
  109. <!--设置TabControl模版样式-->
  110. <ControlTemplate x:Key="TabStackPanelControlTemplate" TargetType="{x:Type TabControl}">
  111. <Grid ClipToBounds="True" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True">
  112. <Grid.ColumnDefinitions>
  113. <ColumnDefinition Name="ColumnDefinition0" Width="*"/>
  114. </Grid.ColumnDefinitions>
  115. <Grid.RowDefinitions>
  116. <RowDefinition Name="RowDefinition0" />
  117. <RowDefinition Name="RowDefinition1" Height="25"/>
  118. </Grid.RowDefinitions>
  119. <StackPanel Name="HeaderPanel"
  120. Orientation="Horizontal"
  121. Grid.Row="1"
  122. Background="#2c4746"
  123. Margin="0,0,0,0"
  124. Panel.ZIndex="1"
  125. IsItemsHost="True"
  126. KeyboardNavigation.TabIndex="1"/>
  127. <Border Name="ContentPanel"
  128. Grid.Row="0"
  129. BorderBrush="{TemplateBinding Border.BorderBrush}"
  130. BorderThickness="{TemplateBinding Border.BorderThickness}"
  131. KeyboardNavigation.DirectionalNavigation="Contained"
  132. KeyboardNavigation.TabIndex="2"
  133. KeyboardNavigation.TabNavigation="Local">
  134. <ContentPresenter Name="PART_SelectedContentHost"
  135. Margin="{TemplateBinding Control.Padding}"
  136. Content="{TemplateBinding TabControl.SelectedContent}"
  137. ContentSource="SelectedContent"
  138. ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}"
  139. ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
  140. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
  141. </Border>
  142. </Grid>
  143. </ControlTemplate>
  144. <!--SmartProcess-->
  145. <Style TargetType="{x:Type TabItem}" x:Key="TabItemSmartProcess">
  146. <Setter Property="Template">
  147. <Setter.Value>
  148. <ControlTemplate TargetType="{x:Type TabItem}">
  149. <Grid>
  150. <Border
  151. Name="Border"
  152. Background="#FFC2E4F6"
  153. BorderBrush="Gray"
  154. BorderThickness="1,1,1,1"
  155. CornerRadius="6,6,0,0" >
  156. <ContentPresenter x:Name="ContentSite"
  157. VerticalAlignment="Center"
  158. HorizontalAlignment="Center"
  159. ContentSource="Header"
  160. Margin="12,2,12,2"/>
  161. </Border>
  162. </Grid>
  163. <ControlTemplate.Triggers>
  164. <Trigger Property="IsSelected" Value="True">
  165. <Setter TargetName="Border" Property="Background" Value="#FFC2E4F6" />
  166. </Trigger>
  167. <Trigger Property="IsSelected" Value="False">
  168. <Setter TargetName="Border" Property="Background" Value="Transparent" />
  169. </Trigger>
  170. </ControlTemplate.Triggers>
  171. </ControlTemplate>
  172. </Setter.Value>
  173. </Setter>
  174. </Style>
  175. <!--设置选项卡大小-->
  176. <Style TargetType="{x:Type TabControl}" x:Key="ChromeLargeTab">
  177. <Setter Property="Background" Value="#FFC5D0D8">
  178. </Setter>
  179. <Setter Property="FontSize" Value="17"></Setter>
  180. <Setter Property="ItemContainerStyle">
  181. <Setter.Value>
  182. <Style>
  183. <Setter Property="Control.Height" Value="24"></Setter>
  184. <Setter Property="Control.Template">
  185. <Setter.Value>
  186. <ControlTemplate TargetType="{x:Type TabItem}">
  187. <!--"M60 0 L 0 0 L 10 23 L 45 23 L 60 0"-->
  188. <Grid Margin="0 0 -10 0">
  189. <Path Data="M120 0 L 0 0 L 10 23 L 90 23 L 120 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  190. Stroke="Black">
  191. </Path>
  192. <ContentPresenter Margin="10 3 10 0" ContentSource="Header" Cursor="Hand" />
  193. </Grid>
  194. <ControlTemplate.Triggers>
  195. <Trigger Property="IsSelected" Value="True">
  196. <Trigger.Setters>
  197. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  198. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  199. </Trigger.Setters>
  200. </Trigger>
  201. <Trigger Property="IsSelected" Value="False">
  202. <Trigger.Setters>
  203. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  204. </Trigger.Setters>
  205. </Trigger>
  206. </ControlTemplate.Triggers>
  207. </ControlTemplate>
  208. </Setter.Value>
  209. </Setter>
  210. </Style>
  211. </Setter.Value>
  212. </Setter>
  213. </Style>
  214. <Style TargetType="{x:Type TabControl}" x:Key="ChromeTabSmall">
  215. <Setter Property="Background" Value="#FFC5D0D8">
  216. </Setter>
  217. <Setter Property="FontSize" Value="17"></Setter>
  218. <Setter Property="ItemContainerStyle">
  219. <Setter.Value>
  220. <Style>
  221. <Setter Property="Control.Height" Value="24"></Setter>
  222. <Setter Property="Control.Template">
  223. <Setter.Value>
  224. <ControlTemplate TargetType="{x:Type TabItem}">
  225. <Grid Margin="0 0 -10 0">
  226. <Path Data="M60 0 L 0 0 L 10 23 L 45 23 L 60 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  227. Stroke="Black">
  228. </Path>
  229. <ContentPresenter Margin="8 3 7 0" ContentSource="Header" Cursor="Hand" />
  230. </Grid>
  231. <ControlTemplate.Triggers>
  232. <Trigger Property="IsSelected" Value="True">
  233. <Trigger.Setters>
  234. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  235. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  236. </Trigger.Setters>
  237. </Trigger>
  238. <Trigger Property="IsSelected" Value="False">
  239. <Trigger.Setters>
  240. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  241. </Trigger.Setters>
  242. </Trigger>
  243. </ControlTemplate.Triggers>
  244. </ControlTemplate>
  245. </Setter.Value>
  246. </Setter>
  247. </Style>
  248. </Setter.Value>
  249. </Setter>
  250. </Style>
  251. <Style TargetType="{x:Type TabItem}" x:Key="Main_TabItem">
  252. <Setter Property="SnapsToDevicePixels" Value="True"/>
  253. <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}"/>
  254. <Setter Property="Background" Value="Transparent"/>
  255. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG}"/>
  256. <Setter Property="FontFamily" Value="Arial"/>
  257. <Setter Property="MinWidth" Value="100"/>
  258. <Setter Property="Height" Value="25"/>
  259. <Setter Property="FontSize" Value="14"/>
  260. <Setter Property="Template">
  261. <Setter.Value>
  262. <ControlTemplate TargetType="{x:Type TabItem}">
  263. <Border x:Name="BG" BorderBrush="{DynamicResource SubMenu_BD_Shadow}" BorderThickness="0,0,2,2" CornerRadius="0,0,5,5" Background="{DynamicResource SubMenu_BG}" Cursor="Hand">
  264. <Border x:Name="InnerBD" BorderBrush="{DynamicResource SubMenu_BD_Highlight}" BorderThickness="2,0,0,0" CornerRadius="0,0,4,4">
  265. <ContentPresenter x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0"/>
  266. </Border>
  267. </Border>
  268. <ControlTemplate.Triggers>
  269. <Trigger Property="IsMouseOver" Value="true" SourceName="BG">
  270. <Setter Property="Background" TargetName="BG" Value="{DynamicResource SubMenu_BG_MouseOver}"/>
  271. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG_Select}"/>
  272. </Trigger>
  273. <Trigger Property="IsSelected" Value="true">
  274. <Setter Property="Background" TargetName="BG" Value="{DynamicResource SubMenu_BG_Select}"/>
  275. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource SubMenu_BD_Shadow_Select}"/>
  276. <Setter Property="BorderBrush" TargetName="InnerBD" Value="{DynamicResource SubMenu_BD_Highlight}"/>
  277. <Setter Property="Foreground" Value="{DynamicResource SubMenu_FG_Select}"/>
  278. <Setter Property="FontSize" Value="16"/>
  279. <Setter Property="Effect" TargetName="Content">
  280. <Setter.Value>
  281. <DropShadowEffect BlurRadius="5" Color="White" ShadowDepth="0"/>
  282. </Setter.Value>
  283. </Setter>
  284. </Trigger>
  285. </ControlTemplate.Triggers>
  286. </ControlTemplate>
  287. </Setter.Value>
  288. </Setter>
  289. </Style>
  290. </ResourceDictionary>