TabControlStyle.xaml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:cus="clr-namespace:PDF_Office.CustomControl">
  5. <Style x:Key="TabControlWithUnderLineStyle" TargetType="{x:Type TabControl}">
  6. <Setter Property="Padding" Value="2" />
  7. <Setter Property="HorizontalContentAlignment" Value="Center" />
  8. <Setter Property="VerticalContentAlignment" Value="Center" />
  9. <Setter Property="Background" Value="Transparent" />
  10. <Setter Property="BorderBrush" Value="#FFACACAC" />
  11. <Setter Property="BorderThickness" Value="0,0,0,1" />
  12. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  13. <Setter Property="Template">
  14. <Setter.Value>
  15. <ControlTemplate TargetType="{x:Type TabControl}">
  16. <Grid
  17. x:Name="templateRoot"
  18. ClipToBounds="True"
  19. KeyboardNavigation.TabNavigation="Local"
  20. SnapsToDevicePixels="True">
  21. <Grid.ColumnDefinitions>
  22. <ColumnDefinition x:Name="ColumnDefinition0" />
  23. <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
  24. </Grid.ColumnDefinitions>
  25. <Grid.RowDefinitions>
  26. <RowDefinition x:Name="RowDefinition0" Height="Auto" />
  27. <RowDefinition x:Name="RowDefinition1" Height="*" />
  28. </Grid.RowDefinitions>
  29. <!-- 加滑轨配合滑轨样式可实现箭头左右滚动的菜单栏 -->
  30. <!--<ScrollViewer Margin="140 0 140 0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">-->
  31. <TabPanel
  32. x:Name="HeaderPanel"
  33. Grid.Row="0"
  34. Grid.Column="0"
  35. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  36. VerticalAlignment="{TemplateBinding VerticalAlignment}"
  37. Panel.ZIndex="1"
  38. Background="Transparent"
  39. IsItemsHost="True"
  40. KeyboardNavigation.TabIndex="1" />
  41. <!--</ScrollViewer>-->
  42. <!-- 页头和中间内容的分割线 -->
  43. <Line
  44. Margin="0,0,0,1"
  45. VerticalAlignment="Bottom"
  46. SnapsToDevicePixels="True"
  47. Stroke="#E7E9EC"
  48. StrokeThickness="0"
  49. X1="0"
  50. X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" />
  51. <Border
  52. x:Name="ContentPanel"
  53. Grid.Row="1"
  54. Grid.Column="0"
  55. Background="{TemplateBinding Background}"
  56. BorderBrush="{TemplateBinding BorderBrush}"
  57. BorderThickness="{TemplateBinding BorderThickness}"
  58. KeyboardNavigation.DirectionalNavigation="Contained"
  59. KeyboardNavigation.TabIndex="2"
  60. KeyboardNavigation.TabNavigation="Local">
  61. <ContentPresenter
  62. x:Name="PART_SelectedContentHost"
  63. Margin="0"
  64. VerticalAlignment="Stretch"
  65. Content="{TemplateBinding SelectedContent}"
  66. ContentSource="SelectedContent"
  67. ContentStringFormat="{TemplateBinding SelectedContentStringFormat}"
  68. ContentTemplate="{TemplateBinding SelectedContentTemplate}"
  69. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  70. </Border>
  71. </Grid>
  72. <ControlTemplate.Triggers>
  73. <Trigger Property="TabStripPlacement" Value="Bottom">
  74. <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
  75. <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
  76. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  77. <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
  78. </Trigger>
  79. <Trigger Property="TabStripPlacement" Value="Left">
  80. <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
  81. <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
  82. <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
  83. <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
  84. <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
  85. <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
  86. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  87. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  88. <Setter TargetName="HeaderPanel" Property="VerticalAlignment" Value="Top" />
  89. </Trigger>
  90. <Trigger Property="TabStripPlacement" Value="Right">
  91. <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
  92. <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
  93. <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
  94. <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
  95. <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
  96. <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
  97. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  98. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  99. </Trigger>
  100. <Trigger Property="IsEnabled" Value="False">
  101. <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  102. </Trigger>
  103. </ControlTemplate.Triggers>
  104. </ControlTemplate>
  105. </Setter.Value>
  106. </Setter>
  107. <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Cycle" />
  108. <Setter Property="KeyboardNavigation.TabNavigation" Value="Cycle" />
  109. </Style>
  110. <Style x:Key="TabItem_WithUnderLineStyle" TargetType="{x:Type cus:IconAndTextTabItem}">
  111. <Setter Property="Foreground" Value="Black" />
  112. <Setter Property="Background" Value="White" />
  113. <Setter Property="BorderBrush" Value="#FFACACAC" />
  114. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  115. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  116. <Setter Property="AllowDrop" Value="True" />
  117. <Setter Property="SelectedForeground" Value="Black" />
  118. <Setter Property="FontSize" Value="14" />
  119. <Setter Property="Height" Value="40" />
  120. <Setter Property="Template">
  121. <Setter.Value>
  122. <ControlTemplate TargetType="{x:Type cus:IconAndTextTabItem}">
  123. <Grid
  124. x:Name="templateRoot"
  125. Margin="{TemplateBinding Padding}"
  126. Background="Transparent"
  127. SnapsToDevicePixels="True">
  128. <Border
  129. x:Name="_underline"
  130. HorizontalAlignment="Stretch"
  131. BorderBrush="#FF477EDE"
  132. BorderThickness="0" />
  133. <StackPanel Orientation="Horizontal">
  134. <Path
  135. x:Name="NormalPathIcon"
  136. MaxWidth="20"
  137. MaxHeight="20"
  138. Margin="0,0,4,0"
  139. Data="{Binding NormalPathIcon, RelativeSource={RelativeSource Mode=TemplatedParent}}"
  140. Fill="Black"
  141. Visibility="Visible" />
  142. <Image
  143. x:Name="SelectedIcon"
  144. MaxWidth="20"
  145. MaxHeight=" 20"
  146. Margin="0,0,4,0"
  147. Source="{Binding SelectedIcon, RelativeSource={RelativeSource Mode=TemplatedParent}}"
  148. Visibility="Collapsed" />
  149. <TextBlock
  150. x:Name="txt"
  151. Margin="0,0,4,0"
  152. HorizontalAlignment="Center"
  153. VerticalAlignment="Center"
  154. Foreground="{TemplateBinding Foreground}"
  155. Text="{TemplateBinding Header}"
  156. TextTrimming="CharacterEllipsis"
  157. ToolTip="{TemplateBinding Header}"
  158. Visibility="Visible" />
  159. </StackPanel>
  160. </Grid>
  161. <ControlTemplate.Triggers>
  162. <MultiDataTrigger>
  163. <MultiDataTrigger.Conditions>
  164. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  165. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  166. </MultiDataTrigger.Conditions>
  167. <Setter TargetName="SelectedIcon" Property="Visibility" Value="Collapsed" />
  168. <Setter TargetName="NormalPathIcon" Property="Visibility" Value="Visible" />
  169. <Setter TargetName="txt" Property="Foreground" Value="#FF000000" />
  170. </MultiDataTrigger>
  171. <MultiDataTrigger>
  172. <MultiDataTrigger.Conditions>
  173. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  174. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
  175. </MultiDataTrigger.Conditions>
  176. <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
  177. </MultiDataTrigger>
  178. <MultiDataTrigger>
  179. <MultiDataTrigger.Conditions>
  180. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  181. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
  182. </MultiDataTrigger.Conditions>
  183. <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
  184. </MultiDataTrigger>
  185. <MultiDataTrigger>
  186. <MultiDataTrigger.Conditions>
  187. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  188. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
  189. </MultiDataTrigger.Conditions>
  190. <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
  191. </MultiDataTrigger>
  192. <MultiDataTrigger>
  193. <MultiDataTrigger.Conditions>
  194. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  195. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  196. </MultiDataTrigger.Conditions>
  197. <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
  198. </MultiDataTrigger>
  199. <MultiDataTrigger>
  200. <MultiDataTrigger.Conditions>
  201. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  202. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  203. </MultiDataTrigger.Conditions>
  204. <Setter TargetName="NormalPathIcon" Property="Opacity" Value="0.56" />
  205. </MultiDataTrigger>
  206. <MultiDataTrigger>
  207. <MultiDataTrigger.Conditions>
  208. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
  209. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  210. </MultiDataTrigger.Conditions>
  211. <Setter Property="Panel.ZIndex" Value="1" />
  212. <Setter TargetName="txt" Property="Foreground" Value="{Binding SelectedForeground, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  213. <Setter TargetName="_underline" Property="BorderThickness" Value="0,0,0,2" />
  214. <Setter TargetName="SelectedIcon" Property="Visibility" Value="Collapsed" />
  215. <Setter TargetName="NormalPathIcon" Property="Visibility" Value="Visible" />
  216. </MultiDataTrigger>
  217. </ControlTemplate.Triggers>
  218. </ControlTemplate>
  219. </Setter.Value>
  220. </Setter>
  221. </Style>
  222. <!-- Design Token TabItem ControlTemplate for Forms Property Title -->
  223. <ControlTemplate x:Key="Segmented" TargetType="{x:Type TabItem}">
  224. <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
  225. <Border
  226. x:Name="mainBorder"
  227. Margin="0"
  228. Background="{TemplateBinding Background}"
  229. BorderBrush="{TemplateBinding BorderBrush}"
  230. BorderThickness="0">
  231. <Border
  232. x:Name="innerBorder"
  233. Height="28"
  234. Margin="-1"
  235. Background="White"
  236. BorderBrush="#FFACACAC"
  237. BorderThickness="0"
  238. CornerRadius="4"
  239. Opacity="0" />
  240. </Border>
  241. <ContentPresenter
  242. x:Name="contentPresenter"
  243. Margin="{TemplateBinding Padding}"
  244. HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"
  245. VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"
  246. Content="{TemplateBinding Header}"
  247. ContentSource="Header"
  248. ContentStringFormat="{TemplateBinding HeaderStringFormat}"
  249. ContentTemplate="{TemplateBinding HeaderTemplate}"
  250. Focusable="False"
  251. RecognizesAccessKey="True"
  252. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  253. </Grid>
  254. <ControlTemplate.Triggers>
  255. <MultiDataTrigger>
  256. <MultiDataTrigger.Conditions>
  257. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  258. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
  259. </MultiDataTrigger.Conditions>
  260. <Setter TargetName="mainBorder" Property="Background">
  261. <Setter.Value>
  262. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  263. <GradientStop Offset="0" Color="#FFECF4FC" />
  264. <GradientStop Offset="1" Color="#FFDCECFC" />
  265. </LinearGradientBrush>
  266. </Setter.Value>
  267. </Setter>
  268. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FF7EB4EA" />
  269. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,0,1" />
  270. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,0,1" />
  271. </MultiDataTrigger>
  272. <MultiDataTrigger>
  273. <MultiDataTrigger.Conditions>
  274. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  275. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
  276. </MultiDataTrigger.Conditions>
  277. <Setter TargetName="mainBorder" Property="Background">
  278. <Setter.Value>
  279. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  280. <GradientStop Offset="0" Color="#FFECF4FC" />
  281. <GradientStop Offset="1" Color="#FFDCECFC" />
  282. </LinearGradientBrush>
  283. </Setter.Value>
  284. </Setter>
  285. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FF7EB4EA" />
  286. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,0,1,1" />
  287. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,0,1,1" />
  288. </MultiDataTrigger>
  289. <MultiDataTrigger>
  290. <MultiDataTrigger.Conditions>
  291. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  292. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
  293. </MultiDataTrigger.Conditions>
  294. <Setter TargetName="mainBorder" Property="Background">
  295. <Setter.Value>
  296. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  297. <GradientStop Offset="0" Color="#FFECF4FC" />
  298. <GradientStop Offset="1" Color="#FFDCECFC" />
  299. </LinearGradientBrush>
  300. </Setter.Value>
  301. </Setter>
  302. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FF7EB4EA" />
  303. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0,1,1,1" />
  304. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0,1,1,1" />
  305. </MultiDataTrigger>
  306. <MultiDataTrigger>
  307. <MultiDataTrigger.Conditions>
  308. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  309. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  310. </MultiDataTrigger.Conditions>
  311. <Setter TargetName="mainBorder" Property="Background">
  312. <Setter.Value>
  313. <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
  314. <GradientStop Offset="0" Color="#FFECF4FC" />
  315. <GradientStop Offset="1" Color="#FFDCECFC" />
  316. </LinearGradientBrush>
  317. </Setter.Value>
  318. </Setter>
  319. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FF7EB4EA" />
  320. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,1,0" />
  321. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,1,0" />
  322. </MultiDataTrigger>
  323. <MultiDataTrigger>
  324. <MultiDataTrigger.Conditions>
  325. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  326. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
  327. </MultiDataTrigger.Conditions>
  328. <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
  329. <Setter TargetName="mainBorder" Property="Background" Value="#FFF0F0F0" />
  330. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FFD9D9D9" />
  331. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,0,1" />
  332. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,0,1" />
  333. </MultiDataTrigger>
  334. <MultiDataTrigger>
  335. <MultiDataTrigger.Conditions>
  336. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  337. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
  338. </MultiDataTrigger.Conditions>
  339. <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
  340. <Setter TargetName="mainBorder" Property="Background" Value="#FFF0F0F0" />
  341. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FFD9D9D9" />
  342. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,0,1,1" />
  343. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,0,1,1" />
  344. </MultiDataTrigger>
  345. <MultiDataTrigger>
  346. <MultiDataTrigger.Conditions>
  347. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  348. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
  349. </MultiDataTrigger.Conditions>
  350. <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
  351. <Setter TargetName="mainBorder" Property="Background" Value="#FFF0F0F0" />
  352. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FFD9D9D9" />
  353. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0,1,1,1" />
  354. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0,1,1,1" />
  355. </MultiDataTrigger>
  356. <MultiDataTrigger>
  357. <MultiDataTrigger.Conditions>
  358. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  359. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  360. </MultiDataTrigger.Conditions>
  361. <Setter TargetName="contentPresenter" Property="Opacity" Value="0.56" />
  362. <Setter TargetName="mainBorder" Property="Background" Value="#FFF0F0F0" />
  363. <Setter TargetName="mainBorder" Property="BorderBrush" Value="#FFD9D9D9" />
  364. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,1,0" />
  365. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,1,0" />
  366. </MultiDataTrigger>
  367. <MultiDataTrigger>
  368. <MultiDataTrigger.Conditions>
  369. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  370. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
  371. </MultiDataTrigger.Conditions>
  372. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,0,1" />
  373. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,0,1" />
  374. </MultiDataTrigger>
  375. <MultiDataTrigger>
  376. <MultiDataTrigger.Conditions>
  377. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
  378. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
  379. </MultiDataTrigger.Conditions>
  380. <Setter Property="Panel.ZIndex" Value="1" />
  381. <Setter Property="Margin" Value="-2,-2,0,-2" />
  382. <Setter TargetName="innerBorder" Property="Opacity" Value="1" />
  383. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,1,0,1" />
  384. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,1,0,1" />
  385. </MultiDataTrigger>
  386. <MultiDataTrigger>
  387. <MultiDataTrigger.Conditions>
  388. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  389. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
  390. </MultiDataTrigger.Conditions>
  391. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,0,1,1" />
  392. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,0,1,1" />
  393. </MultiDataTrigger>
  394. <MultiDataTrigger>
  395. <MultiDataTrigger.Conditions>
  396. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
  397. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
  398. </MultiDataTrigger.Conditions>
  399. <Setter Property="Panel.ZIndex" Value="1" />
  400. <Setter Property="Margin" Value="-2,0,-2,-2" />
  401. <Setter TargetName="innerBorder" Property="Opacity" Value="1" />
  402. <Setter TargetName="innerBorder" Property="BorderThickness" Value="1,0,1,1" />
  403. <Setter TargetName="mainBorder" Property="BorderThickness" Value="1,0,1,1" />
  404. </MultiDataTrigger>
  405. <MultiDataTrigger>
  406. <MultiDataTrigger.Conditions>
  407. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  408. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
  409. </MultiDataTrigger.Conditions>
  410. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0,1,1,1" />
  411. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0,1,1,1" />
  412. </MultiDataTrigger>
  413. <MultiDataTrigger>
  414. <MultiDataTrigger.Conditions>
  415. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
  416. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
  417. </MultiDataTrigger.Conditions>
  418. <Setter Property="Panel.ZIndex" Value="1" />
  419. <Setter Property="Margin" Value="0,-2,-2,-2" />
  420. <Setter TargetName="innerBorder" Property="Opacity" Value="1" />
  421. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0,1,1,1" />
  422. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0,1,1,1" />
  423. </MultiDataTrigger>
  424. <MultiDataTrigger>
  425. <MultiDataTrigger.Conditions>
  426. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
  427. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  428. </MultiDataTrigger.Conditions>
  429. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0" />
  430. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0" />
  431. <Setter TargetName="mainBorder" Property="Background" Value="Transparent" />
  432. </MultiDataTrigger>
  433. <MultiDataTrigger>
  434. <MultiDataTrigger.Conditions>
  435. <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
  436. <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
  437. </MultiDataTrigger.Conditions>
  438. <Setter Property="Panel.ZIndex" Value="1" />
  439. <Setter Property="Margin" Value="0" />
  440. <Setter TargetName="innerBorder" Property="Opacity" Value="1" />
  441. <Setter TargetName="innerBorder" Property="BorderThickness" Value="0" />
  442. <Setter TargetName="mainBorder" Property="BorderThickness" Value="0" />
  443. <Setter TargetName="mainBorder" Property="Background" Value="Transparent" />
  444. </MultiDataTrigger>
  445. </ControlTemplate.Triggers>
  446. </ControlTemplate>
  447. <!-- design token TabHeader for Forms Property -->
  448. <Style x:Key="FormTabControl" TargetType="{x:Type TabControl}">
  449. <Setter Property="Padding" Value="2" />
  450. <Setter Property="HorizontalContentAlignment" Value="Center" />
  451. <Setter Property="VerticalContentAlignment" Value="Center" />
  452. <Setter Property="BorderThickness" Value="1" />
  453. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  454. <Setter Property="Template">
  455. <Setter.Value>
  456. <ControlTemplate TargetType="{x:Type TabControl}">
  457. <Grid
  458. x:Name="templateRoot"
  459. ClipToBounds="true"
  460. KeyboardNavigation.TabNavigation="Local"
  461. SnapsToDevicePixels="true">
  462. <Grid.ColumnDefinitions>
  463. <ColumnDefinition x:Name="ColumnDefinition0" />
  464. <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
  465. </Grid.ColumnDefinitions>
  466. <Grid.RowDefinitions>
  467. <RowDefinition x:Name="RowDefinition0" Height="Auto" />
  468. <RowDefinition x:Name="RowDefinition1" Height="*" />
  469. </Grid.RowDefinitions>
  470. <Border
  471. Grid.Row="0"
  472. Grid.Column="0"
  473. Background="{StaticResource color.sys.layout.fg.dark}"
  474. CornerRadius="4">
  475. <TabPanel
  476. x:Name="headerPanel"
  477. Margin="2"
  478. HorizontalAlignment="Center"
  479. VerticalAlignment="Center"
  480. Panel.ZIndex="1"
  481. Background="Transparent"
  482. IsItemsHost="true"
  483. KeyboardNavigation.TabIndex="1" />
  484. </Border>
  485. <Border
  486. x:Name="contentPanel"
  487. Grid.Row="1"
  488. Grid.Column="0"
  489. Background="{TemplateBinding Background}"
  490. BorderBrush="{TemplateBinding BorderBrush}"
  491. BorderThickness="{TemplateBinding BorderThickness}"
  492. KeyboardNavigation.DirectionalNavigation="Contained"
  493. KeyboardNavigation.TabIndex="2"
  494. KeyboardNavigation.TabNavigation="Local">
  495. <ContentPresenter
  496. x:Name="PART_SelectedContentHost"
  497. Margin="{TemplateBinding Padding}"
  498. ContentSource="SelectedContent"
  499. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  500. </Border>
  501. </Grid>
  502. <ControlTemplate.Triggers>
  503. <Trigger Property="TabStripPlacement" Value="Bottom">
  504. <Setter TargetName="headerPanel" Property="Grid.Row" Value="1" />
  505. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  506. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  507. <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
  508. <Setter TargetName="headerPanel" Property="Margin" Value="2,0,2,2" />
  509. </Trigger>
  510. <Trigger Property="TabStripPlacement" Value="Left">
  511. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  512. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  513. <Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
  514. <Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
  515. <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
  516. <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
  517. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  518. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  519. <Setter TargetName="headerPanel" Property="Margin" Value="2,2,0,2" />
  520. </Trigger>
  521. <Trigger Property="TabStripPlacement" Value="Right">
  522. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  523. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  524. <Setter TargetName="headerPanel" Property="Grid.Column" Value="1" />
  525. <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
  526. <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
  527. <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
  528. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  529. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  530. <Setter TargetName="headerPanel" Property="Margin" Value="0,2,2,2" />
  531. </Trigger>
  532. <Trigger Property="IsEnabled" Value="false">
  533. <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  534. </Trigger>
  535. </ControlTemplate.Triggers>
  536. </ControlTemplate>
  537. </Setter.Value>
  538. </Setter>
  539. </Style>
  540. </ResourceDictionary>