TabControlStyle.xaml 17 KB

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