csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
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.
128 lines
6.4 KiB
128 lines
6.4 KiB
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
x:ClassModifier="internal">
|
|
<Design.PreviewWith>
|
|
<Border Padding="20">
|
|
<StackPanel Spacing="20">
|
|
<TabItem Header="Leaf" />
|
|
<TabItem Header="Arch" IsSelected="True" />
|
|
<TabItem Header="Background" Background="Yellow"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</Design.PreviewWith>
|
|
|
|
<x:Double x:Key="TabItemMinHeight">48</x:Double>
|
|
<x:Double x:Key="TabItemVerticalPipeHeight">24</x:Double>
|
|
<x:Double x:Key="TabItemPipeThickness">2</x:Double>
|
|
|
|
<ControlTheme x:Key="{x:Type TabItem}" TargetType="TabItem">
|
|
<Setter Property="FontSize" Value="{DynamicResource TabItemHeaderFontSize}" />
|
|
<Setter Property="FontWeight" Value="{DynamicResource TabItemHeaderThemeFontWeight}" />
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundUnselected}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TabItemHeaderForegroundUnselected}" />
|
|
<Setter Property="Padding" Value="{DynamicResource TabItemHeaderMargin}" />
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="MinHeight" Value="{DynamicResource TabItemMinHeight}" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border
|
|
Name="PART_LayoutRoot"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
Padding="{TemplateBinding Padding}">
|
|
<Panel>
|
|
<ContentPresenter
|
|
Name="PART_ContentPresenter"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding Header}"
|
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
|
RecognizesAccessKey="True"
|
|
/>
|
|
<Border Name="PART_SelectedPipe"
|
|
Background="{DynamicResource TabItemHeaderSelectedPipeFill}"
|
|
CornerRadius="{DynamicResource ControlCornerRadius}"
|
|
IsVisible="False"/>
|
|
</Panel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<!-- Selected state -->
|
|
<!-- We don't use selector to PART_LayoutRoot, so developer can override selected item background with TabStripItem.Background -->
|
|
<Style Selector="^:selected">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundSelected}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TabItemHeaderForegroundSelected}" />
|
|
</Style>
|
|
<Style Selector="^:selected /template/ Border#PART_SelectedPipe">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
|
|
<!-- PointerOver state -->
|
|
<Style Selector="^:pointerover /template/ Border#PART_LayoutRoot">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundUnselectedPointerOver}" />
|
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TabItemHeaderForegroundUnselectedPointerOver}" />
|
|
</Style>
|
|
|
|
<!-- Selected PointerOver state -->
|
|
<Style Selector="^:selected:pointerover /template/ Border#PART_LayoutRoot">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundSelectedPointerOver}" />
|
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TabItemHeaderForegroundSelectedPointerOver}" />
|
|
</Style>
|
|
|
|
<!-- Pressed state -->
|
|
<Style Selector="^:pressed /template/ Border#PART_LayoutRoot">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundUnselectedPressed}" />
|
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TabItemHeaderForegroundUnselectedPressed}" />
|
|
</Style>
|
|
|
|
<!-- Selected Pressed state -->
|
|
<Style Selector="^:selected:pressed /template/ Border#PART_LayoutRoot">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundSelectedPressed}" />
|
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TabItemHeaderForegroundSelectedPressed}" />
|
|
</Style>
|
|
|
|
<!-- Disabled state -->
|
|
<Style Selector="^:disabled /template/ Border#PART_LayoutRoot">
|
|
<Setter Property="Background" Value="{DynamicResource TabItemHeaderBackgroundDisabled}" />
|
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource TabItemHeaderForegroundDisabled}" />
|
|
</Style>
|
|
|
|
<!-- TabStripPlacement States Group -->
|
|
<Style Selector="^[TabStripPlacement=Left] /template/ Border#PART_SelectedPipe">
|
|
<Setter Property="Width" Value="{DynamicResource TabItemPipeThickness}" />
|
|
<Setter Property="Height" Value="{DynamicResource TabItemVerticalPipeHeight}" />
|
|
<Setter Property="Margin" Value="0,0,2,0" />
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
<Style Selector="^[TabStripPlacement=Left] /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Margin" Value="8,0,0,0" />
|
|
</Style>
|
|
|
|
<Style Selector="^[TabStripPlacement=Top] /template/ Border#PART_SelectedPipe, ^[TabStripPlacement=Bottom] /template/ Border#PART_SelectedPipe">
|
|
<Setter Property="Height" Value="{DynamicResource TabItemPipeThickness}" />
|
|
<Setter Property="Margin" Value="0,0,0,2" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
|
</Style>
|
|
|
|
<Style Selector="^[TabStripPlacement=Right] /template/ Border#PART_SelectedPipe">
|
|
<Setter Property="Width" Value="{DynamicResource TabItemPipeThickness}" />
|
|
<Setter Property="Height" Value="{DynamicResource TabItemVerticalPipeHeight}" />
|
|
<Setter Property="Margin" Value="2,0,0,0" />
|
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
</Style>
|
|
<Style Selector="^[TabStripPlacement=Right] /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="Margin" Value="0,0,8,0" />
|
|
</Style>
|
|
<Style Selector="^[TabStripPlacement=Right]">
|
|
<Setter Property="HorizontalContentAlignment" Value="Right" />
|
|
</Style>
|
|
</ControlTheme>
|
|
</ResourceDictionary>
|
|
|