Tab.xaml 12 KB

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