You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
42 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/ScrollViewer.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="RubyerTabItem" TargetType="{x:Type TabItem}">
  8. <Setter Property="Background" Value="Transparent" />
  9. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  10. <Setter Property="Foreground" Value="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  11. <Setter Property="Padding" Value="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  12. <Setter Property="HorizontalAlignment" Value="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  13. <Setter Property="VerticalAlignment" Value="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  14. <Setter Property="FontSize" Value="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  15. <Setter Property="FontWeight" Value="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  16. <Setter Property="FontFamily" Value="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  17. <Setter Property="bpa:TabControlHelper.IsClearable" Value="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  18. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  19. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  20. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  21. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  22. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  23. <Setter Property="Template">
  24. <Setter.Value>
  25. <ControlTemplate TargetType="{x:Type TabItem}">
  26. <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
  27. <bpa:ControlMask x:Name="mask"
  28. Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  29. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  30. IsActive="{TemplateBinding IsSelected}"
  31. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  32. <DockPanel x:Name="contentPanel"
  33. Margin="{TemplateBinding Padding}"
  34. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  35. VerticalAlignment="{TemplateBinding VerticalAlignment}">
  36. <Button x:Name="clearButton"
  37. Style="{StaticResource TextButton}"
  38. Margin="5 0 0 0"
  39. Padding="2"
  40. bpa:ButtonHelper.Shape="Circle"
  41. bpa:ControlHelper.FocusedBrush="{DynamicResource MaskDark}"
  42. DockPanel.Dock="Right"
  43. Foreground="{TemplateBinding Foreground}"
  44. Visibility="Hidden">
  45. <bpa:Icon Type="CloseLine" />
  46. </Button>
  47. <ContentPresenter x:Name="contentPresenter"
  48. ContentSource="Header"
  49. Focusable="False"
  50. RecognizesAccessKey="True"
  51. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  52. </DockPanel>
  53. </Grid>
  54. <ControlTemplate.Triggers>
  55. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Left">
  56. <Setter Property="HorizontalAlignment" Value="Stretch" />
  57. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  58. </DataTrigger>
  59. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Right">
  60. <Setter Property="HorizontalAlignment" Value="Stretch" />
  61. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  62. </DataTrigger>
  63. <DataTrigger Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="False">
  64. <Setter TargetName="clearButton" Property="Visibility" Value="Collapsed" />
  65. </DataTrigger>
  66. <MultiDataTrigger>
  67. <MultiDataTrigger.Conditions>
  68. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
  69. <Condition Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="True" />
  70. </MultiDataTrigger.Conditions>
  71. <Setter TargetName="clearButton" Property="Visibility" Value="Visible" />
  72. </MultiDataTrigger>
  73. <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
  74. <Setter Property="TextBlock.Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=Self}}" />
  75. </DataTrigger>
  76. <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False">
  77. <Setter TargetName="templateRoot" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  78. </DataTrigger>
  79. </ControlTemplate.Triggers>
  80. </ControlTemplate>
  81. </Setter.Value>
  82. </Setter>
  83. </Style>
  84. <Style x:Key="RubyerTabControl" TargetType="{x:Type TabControl}">
  85. <Setter Property="Background" Value="Transparent" />
  86. <Setter Property="BorderBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  87. <Setter Property="BorderThickness" Value="0 2.5 0 0" />
  88. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  89. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  90. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  91. <Setter Property="ItemContainerStyle" Value="{StaticResource RubyerTabItem}" />
  92. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource TopControlCornerRadius}" />
  93. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
  94. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
  95. <Setter Property="bpa:ControlHelper.FocusBorderBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Self}}" />
  96. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="1" />
  97. <Setter Property="bpa:TabControlHelper.IsClearable" Value="False" />
  98. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Center" />
  99. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Center" />
  100. <Setter Property="bpa:HeaderHelper.Padding" Value="10 5" />
  101. <Setter Property="bpa:HeaderHelper.Margin" Value="0" />
  102. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  103. <Setter Property="bpa:HeaderHelper.Background" Value="Transparent" />
  104. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}}" />
  105. <Setter Property="Template">
  106. <Setter.Value>
  107. <ControlTemplate TargetType="{x:Type TabControl}">
  108. <Grid x:Name="templateRoot"
  109. ClipToBounds="True"
  110. KeyboardNavigation.TabNavigation="Local"
  111. SnapsToDevicePixels="True">
  112. <Grid.ColumnDefinitions>
  113. <ColumnDefinition x:Name="ColumnDefinition0" />
  114. <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
  115. <ColumnDefinition x:Name="ColumnDefinition2" Width="0" />
  116. </Grid.ColumnDefinitions>
  117. <Grid.RowDefinitions>
  118. <RowDefinition x:Name="RowDefinition0" Height="Auto" />
  119. <RowDefinition x:Name="RowDefinition1" Height="0" />
  120. <RowDefinition x:Name="RowDefinition2" Height="*" />
  121. </Grid.RowDefinitions>
  122. <ScrollViewer x:Name="headerPanel"
  123. Style="{StaticResource OnlyArrowScrollViewer}"
  124. Grid.Row="0"
  125. Grid.Column="0"
  126. Panel.ZIndex="1"
  127. bpa:ScrollViewerHelper.HorizontalDelta="150"
  128. bpa:ScrollViewerHelper.VerticalDelta="75"
  129. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  130. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  131. HorizontalScrollBarVisibility="Auto"
  132. VerticalScrollBarVisibility="Auto">
  133. <StackPanel x:Name="headerStackPanel" Orientation="Horizontal">
  134. <TabPanel IsItemsHost="True" KeyboardNavigation.TabIndex="1" />
  135. <Button x:Name="PART_AddButton"
  136. Style="{StaticResource TextButton}"
  137. Margin="5 0 0 0"
  138. bpa:ButtonHelper.Shape="Circle"
  139. bpa:ControlHelper.FocusedBrush="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  140. Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollViewer}}"
  141. Visibility="{Binding Path=(bpa:TabControlHelper.IsShowAddButton), Converter={StaticResource BooleanToVisibleConverter}, RelativeSource={RelativeSource Mode=TemplatedParent}}">
  142. <bpa:Icon Type="AddLine" />
  143. </Button>
  144. </StackPanel>
  145. </ScrollViewer>
  146. <Border x:Name="contentPanel"
  147. Grid.Row="2"
  148. Grid.Column="0"
  149. Margin="0 -2.5 0 0"
  150. Background="{TemplateBinding Background}"
  151. BorderBrush="{TemplateBinding BorderBrush}"
  152. BorderThickness="{TemplateBinding BorderThickness}"
  153. KeyboardNavigation.DirectionalNavigation="Contained"
  154. KeyboardNavigation.TabIndex="2"
  155. KeyboardNavigation.TabNavigation="Local">
  156. <ContentPresenter x:Name="PART_SelectedContentHost"
  157. Margin="{TemplateBinding Padding}"
  158. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  159. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  160. ContentSource="SelectedContent"
  161. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  162. </Border>
  163. </Grid>
  164. <ControlTemplate.Triggers>
  165. <Trigger Property="TabStripPlacement" Value="Bottom">
  166. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  167. <Setter TargetName="RowDefinition2" Property="Height" Value="Auto" />
  168. <Setter TargetName="contentPanel" Property="BorderThickness" Value="0 0 0 2.5" />
  169. <Setter TargetName="contentPanel" Property="Margin" Value="0 0 0 -2.5" />
  170. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  171. <Setter TargetName="headerPanel" Property="Grid.Row" Value="2" />
  172. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource BottomControlCornerRadius}" />
  173. </Trigger>
  174. <Trigger Property="TabStripPlacement" Value="Left">
  175. <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
  176. <Setter TargetName="ColumnDefinition1" Property="Width" Value="0" />
  177. <Setter TargetName="ColumnDefinition2" Property="Width" Value="*" />
  178. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  179. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  180. <Setter TargetName="RowDefinition2" Property="Height" Value="0" />
  181. <Setter TargetName="contentPanel" Property="Grid.Column" Value="2" />
  182. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  183. <Setter TargetName="contentPanel" Property="BorderThickness" Value="2.5 0 0 0" />
  184. <Setter TargetName="contentPanel" Property="Margin" Value="-2.5 0 0 0" />
  185. <Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
  186. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  187. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource LeftControlCornerRadius}" />
  188. <Setter TargetName="headerStackPanel" Property="Orientation" Value="Vertical" />
  189. </Trigger>
  190. <Trigger Property="TabStripPlacement" Value="Right">
  191. <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
  192. <Setter TargetName="ColumnDefinition1" Property="Width" Value="0" />
  193. <Setter TargetName="ColumnDefinition2" Property="Width" Value="Auto" />
  194. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  195. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  196. <Setter TargetName="RowDefinition2" Property="Height" Value="0" />
  197. <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
  198. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  199. <Setter TargetName="contentPanel" Property="BorderThickness" Value="0 0 2.5 0" />
  200. <Setter TargetName="contentPanel" Property="Margin" Value="0 0 -2.5 0" />
  201. <Setter TargetName="headerPanel" Property="Grid.Column" Value="2" />
  202. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  203. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource RightControlCornerRadius}" />
  204. <Setter TargetName="headerStackPanel" Property="Orientation" Value="Vertical" />
  205. </Trigger>
  206. <Trigger Property="IsEnabled" Value="False">
  207. <Setter TargetName="templateRoot" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  208. </Trigger>
  209. </ControlTemplate.Triggers>
  210. </ControlTemplate>
  211. </Setter.Value>
  212. </Setter>
  213. </Style>
  214. <Style x:Key="LineTabItem" TargetType="{x:Type TabItem}">
  215. <Setter Property="Background" Value="Transparent" />
  216. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  217. <Setter Property="Foreground" Value="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  218. <Setter Property="Padding" Value="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  219. <Setter Property="HorizontalAlignment" Value="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  220. <Setter Property="VerticalAlignment" Value="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  221. <Setter Property="bpa:TabControlHelper.IsClearable" Value="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  222. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  223. <Setter Property="FontSize" Value="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  224. <Setter Property="FontWeight" Value="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  225. <Setter Property="FontFamily" Value="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  226. <Setter Property="Template">
  227. <Setter.Value>
  228. <ControlTemplate TargetType="{x:Type TabItem}">
  229. <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
  230. <Border x:Name="mainBorder"
  231. Margin="0"
  232. Background="{TemplateBinding Background}"
  233. BorderBrush="{TemplateBinding BorderBrush}"
  234. BorderThickness="0"
  235. SnapsToDevicePixels="True" />
  236. <DockPanel>
  237. <bpa:Transition x:Name="lineTransirion"
  238. DockPanel.Dock="Bottom"
  239. IsShow="{TemplateBinding IsSelected}"
  240. Type="CollapseLeft">
  241. <Rectangle x:Name="line"
  242. Width="{Binding ActualWidth, ElementName=templateRoot}"
  243. Height="2.5"
  244. Fill="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  245. </bpa:Transition>
  246. <DockPanel Margin="{TemplateBinding Padding}"
  247. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  248. VerticalAlignment="{TemplateBinding VerticalAlignment}">
  249. <Button x:Name="clearButton"
  250. Style="{StaticResource TextButton}"
  251. Margin="5 0 0 0"
  252. Padding="2"
  253. bpa:ButtonHelper.Shape="Circle"
  254. DockPanel.Dock="Right"
  255. Foreground="{TemplateBinding Foreground}"
  256. Visibility="Hidden">
  257. <bpa:Icon Type="CloseLine" />
  258. </Button>
  259. <ContentPresenter x:Name="contentPresenter"
  260. ContentSource="Header"
  261. Focusable="False"
  262. RecognizesAccessKey="True"
  263. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  264. </DockPanel>
  265. </DockPanel>
  266. </Grid>
  267. <ControlTemplate.Triggers>
  268. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Left">
  269. <Setter Property="HorizontalAlignment" Value="Stretch" />
  270. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  271. <Setter TargetName="line" Property="Height" Value="{Binding ActualHeight, ElementName=templateRoot}" />
  272. <Setter TargetName="line" Property="Width" Value="2.5" />
  273. <Setter TargetName="lineTransirion" Property="DockPanel.Dock" Value="Right" />
  274. <Setter TargetName="lineTransirion" Property="Type" Value="CollapseDown" />
  275. </DataTrigger>
  276. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Right">
  277. <Setter Property="HorizontalAlignment" Value="Stretch" />
  278. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  279. <Setter TargetName="line" Property="Height" Value="{Binding ActualHeight, ElementName=templateRoot}" />
  280. <Setter TargetName="line" Property="Width" Value="2.5" />
  281. <Setter TargetName="lineTransirion" Property="DockPanel.Dock" Value="Left" />
  282. <Setter TargetName="lineTransirion" Property="Type" Value="CollapseDown" />
  283. </DataTrigger>
  284. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Bottom">
  285. <Setter TargetName="lineTransirion" Property="DockPanel.Dock" Value="Top" />
  286. </DataTrigger>
  287. <DataTrigger Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="False">
  288. <Setter TargetName="clearButton" Property="Visibility" Value="Collapsed" />
  289. </DataTrigger>
  290. <MultiDataTrigger>
  291. <MultiDataTrigger.Conditions>
  292. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
  293. <Condition Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="True" />
  294. </MultiDataTrigger.Conditions>
  295. <Setter TargetName="clearButton" Property="Visibility" Value="Visible" />
  296. </MultiDataTrigger>
  297. <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
  298. <Setter Property="TextBlock.Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=Self}}" />
  299. </DataTrigger>
  300. <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
  301. <Setter Property="TextBlock.Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=Self}}" />
  302. </DataTrigger>
  303. <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False">
  304. <Setter TargetName="templateRoot" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  305. </DataTrigger>
  306. </ControlTemplate.Triggers>
  307. </ControlTemplate>
  308. </Setter.Value>
  309. </Setter>
  310. </Style>
  311. <Style x:Key="LineTabControl"
  312. BasedOn="{StaticResource RubyerTabControl}"
  313. TargetType="{x:Type TabControl}">
  314. <Setter Property="BorderBrush" Value="{DynamicResource BorderLighter}" />
  315. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource Primary}" />
  316. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Self}}" />
  317. <Setter Property="bpa:ControlHelper.FocusBorderBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Self}}" />
  318. <Setter Property="ItemContainerStyle" Value="{StaticResource LineTabItem}" />
  319. </Style>
  320. <Style x:Key="CardTabItem" TargetType="{x:Type TabItem}">
  321. <Setter Property="Background" Value="Transparent" />
  322. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  323. <Setter Property="Foreground" Value="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  324. <Setter Property="Padding" Value="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  325. <Setter Property="HorizontalAlignment" Value="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  326. <Setter Property="VerticalAlignment" Value="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  327. <Setter Property="FontSize" Value="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  328. <Setter Property="FontWeight" Value="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  329. <Setter Property="FontFamily" Value="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  330. <Setter Property="bpa:TabControlHelper.IsClearable" Value="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  331. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  332. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  333. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  334. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  335. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource AncestorType=TabControl}}" />
  336. <Setter Property="Template">
  337. <Setter.Value>
  338. <ControlTemplate TargetType="{x:Type TabItem}">
  339. <Grid x:Name="templateRoot"
  340. Margin="{Binding Path=(bpa:HeaderHelper.Margin), RelativeSource={RelativeSource AncestorType=TabControl}}"
  341. SnapsToDevicePixels="True">
  342. <bpa:ControlMask x:Name="mask"
  343. Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  344. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  345. IsActive="{TemplateBinding IsSelected}"
  346. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  347. <DockPanel x:Name="contentPanel"
  348. Margin="{TemplateBinding Padding}"
  349. HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
  350. VerticalAlignment="{TemplateBinding VerticalAlignment}">
  351. <Button x:Name="clearButton"
  352. Style="{StaticResource TextButton}"
  353. Margin="5 0 0 0"
  354. Padding="2"
  355. bpa:ButtonHelper.Shape="Circle"
  356. bpa:ControlHelper.FocusedBrush="{DynamicResource MaskDark}"
  357. DockPanel.Dock="Right"
  358. Foreground="{TemplateBinding Foreground}"
  359. Visibility="Hidden">
  360. <bpa:Icon Type="CloseLine" />
  361. </Button>
  362. <ContentPresenter x:Name="contentPresenter"
  363. ContentSource="Header"
  364. Focusable="False"
  365. RecognizesAccessKey="True"
  366. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  367. </DockPanel>
  368. </Grid>
  369. <ControlTemplate.Triggers>
  370. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Left">
  371. <Setter Property="HorizontalAlignment" Value="Stretch" />
  372. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  373. </DataTrigger>
  374. <DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="Right">
  375. <Setter Property="HorizontalAlignment" Value="Stretch" />
  376. <Setter TargetName="contentPresenter" Property="HorizontalAlignment" Value="Center" />
  377. </DataTrigger>
  378. <DataTrigger Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="False">
  379. <Setter TargetName="clearButton" Property="Visibility" Value="Collapsed" />
  380. </DataTrigger>
  381. <MultiDataTrigger>
  382. <MultiDataTrigger.Conditions>
  383. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True" />
  384. <Condition Binding="{Binding Path=(bpa:TabControlHelper.IsClearable), RelativeSource={RelativeSource Self}}" Value="True" />
  385. </MultiDataTrigger.Conditions>
  386. <Setter TargetName="clearButton" Property="Visibility" Value="Visible" />
  387. </MultiDataTrigger>
  388. <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True">
  389. <Setter Property="Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=Self}}" />
  390. </DataTrigger>
  391. <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="False">
  392. <Setter TargetName="templateRoot" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  393. </DataTrigger>
  394. </ControlTemplate.Triggers>
  395. </ControlTemplate>
  396. </Setter.Value>
  397. </Setter>
  398. </Style>
  399. <Style x:Key="CardTabControl"
  400. BasedOn="{StaticResource RubyerTabControl}"
  401. TargetType="{x:Type TabControl}">
  402. <Setter Property="BorderBrush" Value="Transparent" />
  403. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
  404. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
  405. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
  406. <Setter Property="ItemContainerStyle" Value="{StaticResource CardTabItem}" />
  407. <Setter Property="bpa:HeaderHelper.Padding" Value="10 5" />
  408. <Setter Property="bpa:HeaderHelper.Margin" Value="2 1" />
  409. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource DefaultForeground}" />
  410. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource HeaderBackground}" />
  411. <Setter Property="Template">
  412. <Setter.Value>
  413. <ControlTemplate TargetType="{x:Type TabControl}">
  414. <Grid x:Name="templateRoot"
  415. ClipToBounds="True"
  416. KeyboardNavigation.TabNavigation="Local"
  417. SnapsToDevicePixels="True">
  418. <Grid.ColumnDefinitions>
  419. <ColumnDefinition x:Name="ColumnDefinition0" />
  420. <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
  421. </Grid.ColumnDefinitions>
  422. <Grid.RowDefinitions>
  423. <RowDefinition x:Name="RowDefinition0" Height="Auto" />
  424. <RowDefinition x:Name="RowDefinition1" Height="*" />
  425. </Grid.RowDefinitions>
  426. <Border x:Name="headerPanel"
  427. Grid.Row="0"
  428. Grid.Column="0"
  429. Padding="2"
  430. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  431. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
  432. <ScrollViewer Style="{StaticResource OnlyArrowScrollViewer}"
  433. bpa:ScrollViewerHelper.HorizontalDelta="150"
  434. bpa:ScrollViewerHelper.VerticalDelta="75"
  435. Background="Transparent"
  436. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  437. HorizontalScrollBarVisibility="Auto"
  438. VerticalScrollBarVisibility="Auto">
  439. <StackPanel x:Name="headerStackPanel" Orientation="Horizontal">
  440. <TabPanel Panel.ZIndex="1"
  441. IsItemsHost="True"
  442. KeyboardNavigation.TabIndex="1" />
  443. <Button x:Name="PART_AddButton"
  444. Style="{StaticResource TextButton}"
  445. Margin="5 0 0 0"
  446. bpa:ButtonHelper.Shape="Circle"
  447. bpa:ControlHelper.FocusedBrush="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  448. Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ScrollViewer}}"
  449. Visibility="{Binding Path=(bpa:TabControlHelper.IsShowAddButton), Converter={StaticResource BooleanToVisibleConverter}, RelativeSource={RelativeSource Mode=TemplatedParent}}">
  450. <bpa:Icon Type="AddLine" />
  451. </Button>
  452. </StackPanel>
  453. </ScrollViewer>
  454. </Border>
  455. <Border x:Name="contentPanel"
  456. Grid.Row="1"
  457. Grid.Column="0"
  458. Background="{TemplateBinding Background}"
  459. BorderBrush="{TemplateBinding BorderBrush}"
  460. BorderThickness="{TemplateBinding BorderThickness}"
  461. KeyboardNavigation.DirectionalNavigation="Contained"
  462. KeyboardNavigation.TabIndex="2"
  463. KeyboardNavigation.TabNavigation="Local">
  464. <ContentPresenter x:Name="PART_SelectedContentHost"
  465. Margin="{TemplateBinding Padding}"
  466. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  467. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  468. ContentSource="SelectedContent"
  469. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  470. </Border>
  471. </Grid>
  472. <ControlTemplate.Triggers>
  473. <Trigger Property="TabStripPlacement" Value="Bottom">
  474. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  475. <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
  476. <Setter TargetName="contentPanel" Property="BorderThickness" Value="0" />
  477. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  478. <Setter TargetName="headerPanel" Property="Grid.Row" Value="2" />
  479. </Trigger>
  480. <Trigger Property="TabStripPlacement" Value="Left">
  481. <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
  482. <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
  483. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  484. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  485. <Setter TargetName="contentPanel" Property="Grid.Column" Value="2" />
  486. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  487. <Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
  488. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  489. <Setter TargetName="headerStackPanel" Property="Orientation" Value="Vertical" />
  490. </Trigger>
  491. <Trigger Property="TabStripPlacement" Value="Right">
  492. <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
  493. <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
  494. <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
  495. <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
  496. <Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
  497. <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
  498. <Setter TargetName="headerPanel" Property="Grid.Column" Value="2" />
  499. <Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
  500. <Setter TargetName="headerStackPanel" Property="Orientation" Value="Vertical" />
  501. </Trigger>
  502. <Trigger Property="IsEnabled" Value="False">
  503. <Setter TargetName="templateRoot" Property="Opacity" Value="{DynamicResource UnenableOpcity}" />
  504. </Trigger>
  505. </ControlTemplate.Triggers>
  506. </ControlTemplate>
  507. </Setter.Value>
  508. </Setter>
  509. </Style>
  510. </ResourceDictionary>