mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-07 09:46:36 +08:00
feat: inherit BaseTabControl.
This commit is contained in:
@@ -35,9 +35,7 @@
|
|||||||
<ItemsPresenter
|
<ItemsPresenter
|
||||||
Name="PART_ItemsPresenter"
|
Name="PART_ItemsPresenter"
|
||||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||||
<Border
|
<Border Name="PART_BorderSeparator" />
|
||||||
Name="PART_BorderSeparator"
|
|
||||||
Background="{DynamicResource SemiColorBorder}" />
|
|
||||||
</Panel>
|
</Panel>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_SelectedContentHost"
|
Name="PART_SelectedContentHost"
|
||||||
@@ -58,12 +56,11 @@
|
|||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
|
||||||
|
|
||||||
<ControlTheme
|
<Style Selector="^ /template/ Border#PART_BorderSeparator">
|
||||||
x:Key="{x:Type TabControl}"
|
<Setter Property="Background" Value="{DynamicResource SemiColorBorder}" />
|
||||||
BasedOn="{StaticResource BaseTabControl}"
|
</Style>
|
||||||
TargetType="TabControl">
|
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="Height" Value="1" />
|
<Setter Property="Height" Value="1" />
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||||
@@ -74,10 +71,22 @@
|
|||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="Width" Value="1" />
|
<Setter Property="Width" Value="1" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="Width" Value="1" />
|
<Setter Property="Width" Value="1" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
|
||||||
|
<ControlTheme
|
||||||
|
x:Key="{x:Type TabControl}"
|
||||||
|
BasedOn="{StaticResource BaseTabControl}"
|
||||||
|
TargetType="TabControl">
|
||||||
|
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
@@ -87,25 +96,12 @@
|
|||||||
BasedOn="{StaticResource BaseTabControl}"
|
BasedOn="{StaticResource BaseTabControl}"
|
||||||
TargetType="TabControl">
|
TargetType="TabControl">
|
||||||
<Setter Property="ItemContainerTheme" Value="{StaticResource LineTabControlItem}" />
|
<Setter Property="ItemContainerTheme" Value="{StaticResource LineTabControlItem}" />
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CardTabControl" TargetType="TabControl">
|
<ControlTheme
|
||||||
|
x:Key="CardTabControl"
|
||||||
|
BasedOn="{StaticResource BaseTabControl}"
|
||||||
|
TargetType="TabControl">
|
||||||
<Setter Property="ItemContainerTheme" Value="{StaticResource CardTabControlItem}" />
|
<Setter Property="ItemContainerTheme" Value="{StaticResource CardTabControlItem}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="TabControl">
|
<ControlTemplate TargetType="TabControl">
|
||||||
@@ -118,9 +114,7 @@
|
|||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
||||||
<Border
|
<Border Name="PART_BorderSeparator" />
|
||||||
Name="PART_BorderSeparator"
|
|
||||||
Background="{DynamicResource SemiColorBorder}" />
|
|
||||||
<ItemsPresenter
|
<ItemsPresenter
|
||||||
Name="PART_ItemsPresenter"
|
Name="PART_ItemsPresenter"
|
||||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||||
@@ -136,31 +130,6 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
|
|
||||||
<Setter Property="TabControl.ItemsPanel">
|
|
||||||
<ItemsPanelTemplate>
|
|
||||||
<WrapPanel Orientation="Vertical" />
|
|
||||||
</ItemsPanelTemplate>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme
|
<ControlTheme
|
||||||
@@ -173,6 +142,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
|
<!-- ScrollTabControl -->
|
||||||
<ControlTheme x:Key="BaseScrollTabControl" TargetType="TabControl">
|
<ControlTheme x:Key="BaseScrollTabControl" TargetType="TabControl">
|
||||||
<Setter Property="ItemsPanel">
|
<Setter Property="ItemsPanel">
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@@ -198,9 +168,7 @@
|
|||||||
Name="PART_ItemsPresenter"
|
Name="PART_ItemsPresenter"
|
||||||
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Border
|
<Border Name="PART_BorderSeparator" />
|
||||||
Name="PART_BorderSeparator"
|
|
||||||
Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
|
||||||
</Panel>
|
</Panel>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_SelectedContentHost"
|
Name="PART_SelectedContentHost"
|
||||||
@@ -214,6 +182,10 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
|
<Style Selector="^ /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource SemiColorBorder}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
|
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
|
||||||
<Setter Property="TabControl.ItemsPanel">
|
<Setter Property="TabControl.ItemsPanel">
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@@ -222,6 +194,23 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="Height" Value="1" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="Height" Value="1" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="Width" Value="1" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
||||||
|
<Setter Property="Width" Value="1" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top]">
|
<Style Selector="^[TabStripPlacement=Top]">
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
||||||
@@ -244,21 +233,10 @@
|
|||||||
x:Key="ScrollTabControl"
|
x:Key="ScrollTabControl"
|
||||||
BasedOn="{StaticResource BaseScrollTabControl}"
|
BasedOn="{StaticResource BaseScrollTabControl}"
|
||||||
TargetType="TabControl">
|
TargetType="TabControl">
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
@@ -268,32 +246,13 @@
|
|||||||
BasedOn="{StaticResource BaseScrollTabControl}"
|
BasedOn="{StaticResource BaseScrollTabControl}"
|
||||||
TargetType="TabControl">
|
TargetType="TabControl">
|
||||||
<Setter Property="ItemContainerTheme" Value="{StaticResource LineTabControlItem}" />
|
<Setter Property="ItemContainerTheme" Value="{StaticResource LineTabControlItem}" />
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="ScrollCardTabControl" TargetType="TabControl">
|
<ControlTheme
|
||||||
|
x:Key="ScrollCardTabControl"
|
||||||
|
BasedOn="{StaticResource BaseScrollTabControl}"
|
||||||
|
TargetType="TabControl">
|
||||||
<Setter Property="ItemContainerTheme" Value="{StaticResource CardTabControlItem}" />
|
<Setter Property="ItemContainerTheme" Value="{StaticResource CardTabControlItem}" />
|
||||||
<Setter Property="ItemsPanel">
|
|
||||||
<ItemsPanelTemplate>
|
|
||||||
<VirtualizingStackPanel Orientation="Horizontal" />
|
|
||||||
</ItemsPanelTemplate>
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="TabControl">
|
<ControlTemplate TargetType="TabControl">
|
||||||
<Border
|
<Border
|
||||||
@@ -305,9 +264,7 @@
|
|||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
<Panel DockPanel.Dock="{TemplateBinding TabStripPlacement}">
|
||||||
<Border
|
<Border Name="PART_BorderSeparator" />
|
||||||
Name="PART_BorderSeparator"
|
|
||||||
Background="{DynamicResource TabItemLinePipePressedBorderBrush}" />
|
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Name="PART_ScrollViewer"
|
Name="PART_ScrollViewer"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
@@ -328,48 +285,6 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Left], ^[TabStripPlacement=Right]">
|
|
||||||
<Setter Property="TabControl.ItemsPanel">
|
|
||||||
<ItemsPanelTemplate>
|
|
||||||
<VirtualizingStackPanel />
|
|
||||||
</ItemsPanelTemplate>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Height" Value="1" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Top" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_BorderSeparator">
|
|
||||||
<Setter Property="Width" Value="1" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="^[TabStripPlacement=Top]">
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Bottom]">
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Left]">
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^[TabStripPlacement=Right]">
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme
|
<ControlTheme
|
||||||
|
|||||||
Reference in New Issue
Block a user