TabControlStyle.xaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. >
  4. <!--通用TabItem样式-->
  5. <Style TargetType="TabItem">
  6. <Setter Property="FrameworkElement.FocusVisualStyle">
  7. <Setter.Value>
  8. <Style TargetType="Control">
  9. <Style.Resources>
  10. <ResourceDictionary />
  11. </Style.Resources>
  12. <Setter Property="Control.Template">
  13. <Setter.Value>
  14. <ControlTemplate>
  15. <Border>
  16. <Rectangle StrokeThickness="0" />
  17. </Border>
  18. </ControlTemplate>
  19. </Setter.Value>
  20. </Setter>
  21. </Style>
  22. </Setter.Value>
  23. </Setter>
  24. </Style>
  25. <!--通用TabControl样式-->
  26. <Style TargetType="{x:Type TabControl}" >
  27. <!--<Setter Property="Background" Value="#FFC5D0D8"/>-->
  28. <Setter Property="Background" Value="#669ACC"/>
  29. <Setter Property="FontFamily" Value="Arial,SimSun"/>
  30. <Setter Property="FontSize" Value="17"></Setter>
  31. <Setter Property="ItemContainerStyle">
  32. <Setter.Value>
  33. <Style>
  34. <Setter Property="Control.Height" Value="24"></Setter>
  35. <Setter Property="Control.Template">
  36. <Setter.Value>
  37. <ControlTemplate TargetType="{x:Type TabItem}">
  38. <Grid Margin="0 0 -10 0">
  39. <Path Data="M190 0 L 0 0 L 10 23 L 170 23 L 190 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  40. Stroke="Black">
  41. </Path>
  42. <ContentPresenter Margin="10 3 10 0" ContentSource="Header" Cursor="Hand" />
  43. </Grid>
  44. <ControlTemplate.Triggers>
  45. <Trigger Property="IsSelected" Value="True">
  46. <Trigger.Setters>
  47. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  48. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  49. </Trigger.Setters>
  50. </Trigger>
  51. <Trigger Property="IsSelected" Value="False">
  52. <Trigger.Setters>
  53. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  54. </Trigger.Setters>
  55. </Trigger>
  56. </ControlTemplate.Triggers>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. </Style>
  61. </Setter.Value>
  62. </Setter>
  63. <Setter Property="Template">
  64. <Setter.Value>
  65. <ControlTemplate TargetType="{x:Type TabControl}">
  66. <Grid ClipToBounds="True" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True">
  67. <Grid.ColumnDefinitions>
  68. <ColumnDefinition Name="ColumnDefinition0" Width="*"/>
  69. </Grid.ColumnDefinitions>
  70. <Grid.RowDefinitions>
  71. <RowDefinition Name="RowDefinition0" />
  72. <RowDefinition Name="RowDefinition1" Height="25"/>
  73. </Grid.RowDefinitions>
  74. <StackPanel Name="HeaderPanel"
  75. Orientation="Horizontal"
  76. Grid.Row="1"
  77. Background="#2c4746"
  78. Margin="0,0,0,0"
  79. Panel.ZIndex="1"
  80. IsItemsHost="True"
  81. KeyboardNavigation.TabIndex="1"/>
  82. <Border Name="ContentPanel"
  83. Grid.Row="0"
  84. Background="{TemplateBinding Panel.Background}"
  85. BorderBrush="{TemplateBinding Border.BorderBrush}"
  86. BorderThickness="{TemplateBinding Border.BorderThickness}"
  87. KeyboardNavigation.DirectionalNavigation="Contained"
  88. KeyboardNavigation.TabIndex="2"
  89. KeyboardNavigation.TabNavigation="Local">
  90. <ContentPresenter Name="PART_SelectedContentHost"
  91. Margin="{TemplateBinding Control.Padding}"
  92. Content="{TemplateBinding TabControl.SelectedContent}"
  93. ContentSource="SelectedContent"
  94. ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}"
  95. ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}"
  96. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"/>
  97. </Border>
  98. </Grid>
  99. </ControlTemplate>
  100. </Setter.Value>
  101. </Setter>
  102. </Style>
  103. <!--设置TabControl模版样式-->
  104. <ControlTemplate x:Key="TabStackPanelControlTemplate" TargetType="{x:Type TabControl}">
  105. <Grid ClipToBounds="True" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="True">
  106. <Grid.ColumnDefinitions>
  107. <ColumnDefinition Name="ColumnDefinition0" Width="*"/>
  108. </Grid.ColumnDefinitions>
  109. <Grid.RowDefinitions>
  110. <RowDefinition Name="RowDefinition0" />
  111. <RowDefinition Name="RowDefinition1" Height="25"/>
  112. </Grid.RowDefinitions>
  113. <StackPanel Name="HeaderPanel"
  114. Orientation="Horizontal"
  115. Grid.Row="1"
  116. Background="#2c4746"
  117. Margin="0,0,0,0"
  118. Panel.ZIndex="1"
  119. IsItemsHost="True"
  120. KeyboardNavigation.TabIndex="1"/>
  121. <Border Name="ContentPanel"
  122. Grid.Row="0"
  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. <!--SmartProcess-->
  139. <Style TargetType="{x:Type TabItem}" x:Key="TabItemSmartProcess">
  140. <Setter Property="Template">
  141. <Setter.Value>
  142. <ControlTemplate TargetType="{x:Type TabItem}">
  143. <Grid>
  144. <Border
  145. Name="Border"
  146. Background="#FFC2E4F6"
  147. BorderBrush="Gray"
  148. BorderThickness="1,1,1,1"
  149. CornerRadius="6,6,0,0" >
  150. <ContentPresenter x:Name="ContentSite"
  151. VerticalAlignment="Center"
  152. HorizontalAlignment="Center"
  153. ContentSource="Header"
  154. Margin="12,2,12,2"/>
  155. </Border>
  156. </Grid>
  157. <ControlTemplate.Triggers>
  158. <Trigger Property="IsSelected" Value="True">
  159. <Setter TargetName="Border" Property="Background" Value="#FFC2E4F6" />
  160. </Trigger>
  161. <Trigger Property="IsSelected" Value="False">
  162. <Setter TargetName="Border" Property="Background" Value="Transparent" />
  163. </Trigger>
  164. </ControlTemplate.Triggers>
  165. </ControlTemplate>
  166. </Setter.Value>
  167. </Setter>
  168. </Style>
  169. <!--设置选项卡大小-->
  170. <Style TargetType="{x:Type TabControl}" x:Key="ChromeLargeTab">
  171. <Setter Property="Background" Value="#FFC5D0D8">
  172. </Setter>
  173. <Setter Property="FontSize" Value="17"></Setter>
  174. <Setter Property="ItemContainerStyle">
  175. <Setter.Value>
  176. <Style>
  177. <Setter Property="Control.Height" Value="24"></Setter>
  178. <Setter Property="Control.Template">
  179. <Setter.Value>
  180. <ControlTemplate TargetType="{x:Type TabItem}">
  181. <!--"M60 0 L 0 0 L 10 23 L 45 23 L 60 0"-->
  182. <Grid Margin="0 0 -10 0">
  183. <Path Data="M120 0 L 0 0 L 10 23 L 90 23 L 120 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  184. Stroke="Black">
  185. </Path>
  186. <ContentPresenter Margin="10 3 10 0" ContentSource="Header" Cursor="Hand" />
  187. </Grid>
  188. <ControlTemplate.Triggers>
  189. <Trigger Property="IsSelected" Value="True">
  190. <Trigger.Setters>
  191. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  192. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  193. </Trigger.Setters>
  194. </Trigger>
  195. <Trigger Property="IsSelected" Value="False">
  196. <Trigger.Setters>
  197. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  198. </Trigger.Setters>
  199. </Trigger>
  200. </ControlTemplate.Triggers>
  201. </ControlTemplate>
  202. </Setter.Value>
  203. </Setter>
  204. </Style>
  205. </Setter.Value>
  206. </Setter>
  207. </Style>
  208. <Style TargetType="{x:Type TabControl}" x:Key="ChromeTabSmall">
  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. <Grid Margin="0 0 -10 0">
  220. <Path Data="M60 0 L 0 0 L 10 23 L 45 23 L 60 0" StrokeThickness="1" Fill="{TemplateBinding Background}"
  221. Stroke="Black">
  222. </Path>
  223. <ContentPresenter Margin="8 3 7 0" ContentSource="Header" Cursor="Hand" />
  224. </Grid>
  225. <ControlTemplate.Triggers>
  226. <Trigger Property="IsSelected" Value="True">
  227. <Trigger.Setters>
  228. <Setter Property="Background" Value="#FFCBD8D8"></Setter>
  229. <Setter Property="Panel.ZIndex" Value="1"></Setter>
  230. </Trigger.Setters>
  231. </Trigger>
  232. <Trigger Property="IsSelected" Value="False">
  233. <Trigger.Setters>
  234. <Setter Property="Background" Value="#FFA7ADAD"></Setter>
  235. </Trigger.Setters>
  236. </Trigger>
  237. </ControlTemplate.Triggers>
  238. </ControlTemplate>
  239. </Setter.Value>
  240. </Setter>
  241. </Style>
  242. </Setter.Value>
  243. </Setter>
  244. </Style>
  245. </ResourceDictionary>