Tab.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d">
  7. <SolidColorBrush x:Key="Tab_Header_BG" Color="#FF024683"/>
  8. <SolidColorBrush x:Key="Tab_BD" Color="#FF233661"/>
  9. <SolidColorBrush x:Key="Tab_BD_Highlight" Color="#FFB3B9D1"/>
  10. <SolidColorBrush x:Key="Tab_Header_BG_MouseOver" Color="#FF57A3D4"/>
  11. <SolidColorBrush x:Key="Tab_Header_BG_Select" Color="#FFCED8E5"/>
  12. <SolidColorBrush x:Key="Tab_BD_Select" Color="#FF6788B1"/>
  13. <SolidColorBrush x:Key="Tab_BD_Highlight_Select" Color="#00B3B9D1"/>
  14. <SolidColorBrush x:Key="Tab_FG_Select" Color="#FF233863"/>
  15. <SolidColorBrush x:Key="Tab_BG" Color="#FFDAE5F1"/>
  16. <SolidColorBrush x:Key="Tab_BD_Unable" Color="Gray"/>
  17. <LinearGradientBrush x:Key="Tab_Header_BG_Unable" EndPoint="0.5,1" StartPoint="0.5,0">
  18. <GradientStop Color="#FFB1B1B1" Offset="0"/>
  19. <GradientStop Color="#FFDADADA" Offset="1"/>
  20. </LinearGradientBrush>
  21. <SolidColorBrush x:Key="Tab_BG_Unable" Color="LightGray"/>
  22. <Style x:Key="TabItemFocusVisual">
  23. <Setter Property="Control.Template">
  24. <Setter.Value>
  25. <ControlTemplate>
  26. <Rectangle Stroke="#7FFFFFFF" StrokeDashArray="1 2" StrokeThickness="1" Margin="3,3,3,1" SnapsToDevicePixels="true"/>
  27. </ControlTemplate>
  28. </Setter.Value>
  29. </Setter>
  30. </Style>
  31. <Style TargetType="{x:Type TabControl}">
  32. <Setter Property="Padding" Value="5"/>
  33. <Setter Property="BorderThickness" Value="1"/>
  34. <Setter Property="BorderBrush" Value="{DynamicResource Tab_BD}"/>
  35. <Setter Property="Background" Value="{DynamicResource Tab_BG}"/>
  36. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  37. <Setter Property="VerticalContentAlignment" Value="Center"/>
  38. <Setter Property="Border.CornerRadius" Value="5"/>
  39. <Setter Property="Template">
  40. <Setter.Value>
  41. <ControlTemplate TargetType="{x:Type TabControl}">
  42. <Grid>
  43. <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
  44. <Grid.ColumnDefinitions>
  45. <ColumnDefinition x:Name="ColumnDefinition0"/>
  46. <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
  47. </Grid.ColumnDefinitions>
  48. <Grid.RowDefinitions>
  49. <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
  50. <RowDefinition x:Name="RowDefinition1" Height="*"/>
  51. </Grid.RowDefinitions>
  52. <TabPanel x:Name="HeaderPanel" Margin="3,0,0,0" IsItemsHost="true" Panel.ZIndex="1" Grid.Column="0" Grid.Row="0" KeyboardNavigation.TabIndex="1"/>
  53. <Border x:Name="ContentPanel" CornerRadius="{TemplateBinding Border.CornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Grid.Column="0" Grid.Row="1" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
  54. <ContentPresenter x:Name="PART_SelectedContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="SelectedContent"/>
  55. </Border>
  56. </Grid>
  57. </Grid>
  58. <ControlTemplate.Triggers>
  59. <Trigger Property="TabStripPlacement" Value="Bottom">
  60. <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
  61. <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
  62. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  63. <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
  64. <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>
  65. </Trigger>
  66. <Trigger Property="TabStripPlacement" Value="Left">
  67. <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
  68. <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
  69. <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
  70. <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
  71. <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
  72. <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
  73. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  74. <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
  75. <Setter Property="Margin" TargetName="HeaderPanel" Value="2,2,0,2"/>
  76. </Trigger>
  77. <Trigger Property="TabStripPlacement" Value="Right">
  78. <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
  79. <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
  80. <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
  81. <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
  82. <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
  83. <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
  84. <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
  85. <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
  86. <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
  87. </Trigger>
  88. <Trigger Property="IsEnabled" Value="false">
  89. <Setter Property="BorderBrush" TargetName="ContentPanel" Value="{DynamicResource Tab_BD_Unable}"/>
  90. <Setter Property="Background" TargetName="ContentPanel" Value="{DynamicResource Tab_BG_Unable}"/>
  91. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  92. </Trigger>
  93. </ControlTemplate.Triggers>
  94. </ControlTemplate>
  95. </Setter.Value>
  96. </Setter>
  97. </Style>
  98. <Style TargetType="{x:Type TabItem}">
  99. <Setter Property="SnapsToDevicePixels" Value="True"/>
  100. <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}"/>
  101. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  102. <Setter Property="BorderBrush" Value="{DynamicResource Tab_BD}"/>
  103. <Setter Property="Background" Value="{DynamicResource Tab_Header_BG}"/>
  104. <Setter Property="FontFamily" Value="Arial"/>
  105. <Setter Property="FontSize" Value="12"/>
  106. <Setter Property="MinWidth" Value="60"/>
  107. <Setter Property="MinHeight" Value="24"/>
  108. <Setter Property="Template">
  109. <Setter.Value>
  110. <ControlTemplate TargetType="{x:Type TabItem}">
  111. <Border x:Name="BG" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" CornerRadius="5,5,0,0" Background="{TemplateBinding Background}" Cursor="Hand">
  112. <Border x:Name="InnerBD" BorderBrush="{DynamicResource Tab_BD_Highlight}" BorderThickness="1,1,0,0" CornerRadius="4,4,0,0">
  113. <ContentPresenter x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,3,10,1">
  114. </ContentPresenter>
  115. </Border>
  116. </Border>
  117. <ControlTemplate.Triggers>
  118. <Trigger Property="IsMouseOver" Value="true" SourceName="BG">
  119. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Tab_Header_BG_MouseOver}"/>
  120. </Trigger>
  121. <Trigger Property="IsSelected" Value="true">
  122. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Tab_Header_BG_Select}"/>
  123. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource Tab_BD_Select}"/>
  124. <Setter Property="BorderBrush" TargetName="InnerBD" Value="{DynamicResource Tab_BD_Highlight_Select}"/>
  125. <Setter Property="Foreground" Value="{DynamicResource Tab_FG_Select}"/>
  126. <Setter Property="FontSize" Value="14"/>
  127. </Trigger>
  128. <Trigger Property="TabStripPlacement" Value="Bottom">
  129. <Setter Property="BorderThickness" TargetName="BG" Value="1,0,1,1"/>
  130. </Trigger>
  131. <Trigger Property="TabStripPlacement" Value="Left">
  132. <Setter Property="BorderThickness" TargetName="BG" Value="1,1,0,1"/>
  133. </Trigger>
  134. <Trigger Property="TabStripPlacement" Value="Right">
  135. <Setter Property="BorderThickness" TargetName="BG" Value="0,1,1,1"/>
  136. </Trigger>
  137. <MultiTrigger>
  138. <MultiTrigger.Conditions>
  139. <Condition Property="IsSelected" Value="true"/>
  140. <Condition Property="TabStripPlacement" Value="Top"/>
  141. </MultiTrigger.Conditions>
  142. <Setter Property="Margin" TargetName="Content" Value="10,3,10,1"/>
  143. </MultiTrigger>
  144. <MultiTrigger>
  145. <MultiTrigger.Conditions>
  146. <Condition Property="IsSelected" Value="true"/>
  147. <Condition Property="TabStripPlacement" Value="Bottom"/>
  148. </MultiTrigger.Conditions>
  149. <Setter Property="Margin" TargetName="Content" Value="5,1,5,0"/>
  150. </MultiTrigger>
  151. <MultiTrigger>
  152. <MultiTrigger.Conditions>
  153. <Condition Property="IsSelected" Value="true"/>
  154. <Condition Property="TabStripPlacement" Value="Left"/>
  155. </MultiTrigger.Conditions>
  156. <Setter Property="Margin" TargetName="Content" Value="5,0,6,0"/>
  157. </MultiTrigger>
  158. <MultiTrigger>
  159. <MultiTrigger.Conditions>
  160. <Condition Property="IsSelected" Value="true"/>
  161. <Condition Property="TabStripPlacement" Value="Right"/>
  162. </MultiTrigger.Conditions>
  163. <Setter Property="Margin" TargetName="Content" Value="6,0,5,0"/>
  164. </MultiTrigger>
  165. <Trigger Property="IsEnabled" Value="false">
  166. <Setter Property="BorderBrush" Value="{DynamicResource Tab_BD_Unable}"/>
  167. <Setter Property="Background" TargetName="BG" Value="{DynamicResource Tab_Header_BG_Unable}"/>
  168. <Setter Property="Foreground" Value="#FF9A9A9A"/>
  169. <Setter Property="Effect" TargetName="Content">
  170. <Setter.Value>
  171. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  172. </Setter.Value>
  173. </Setter>
  174. </Trigger>
  175. </ControlTemplate.Triggers>
  176. </ControlTemplate>
  177. </Setter.Value>
  178. </Setter>
  179. </Style>
  180. </ResourceDictionary>