2 changed files with 102 additions and 19 deletions
@ -1,23 +1,100 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Padding="20"> |
||||
|
<StackPanel Spacing="20"> |
||||
|
<TabStripItem>Leaf</TabStripItem> |
||||
|
<TabStripItem IsSelected="True">Arch</TabStripItem> |
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
<Styles.Resources> |
||||
|
<x:Double x:Key="TabStripItemHeight">48</x:Double> |
||||
|
</Styles.Resources> |
||||
|
|
||||
<Style Selector="TabStripItem"> |
<Style Selector="TabStripItem"> |
||||
<Setter Property="Background" Value="Transparent"/> |
<Setter Property="FontSize" Value="{DynamicResource PivotHeaderItemFontSize}" /> |
||||
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}"/> |
<Setter Property="FontWeight" Value="{DynamicResource PivotHeaderItemThemeFontWeight}" /> |
||||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}"/> |
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselected}" /> |
||||
|
<Setter Property="Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselected}" /> |
||||
|
<Setter Property="Padding" Value="{DynamicResource PivotHeaderItemMargin}" /> |
||||
|
<Setter Property="Margin" Value="0" /> |
||||
|
<Setter Property="Height" Value="{DynamicResource TabStripItemHeight}" /> |
||||
|
<Setter Property="VerticalContentAlignment" Value="Center" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<ContentPresenter Name="PART_ContentPresenter" |
<Border Name="PART_LayoutRoot" |
||||
Background="{TemplateBinding Background}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
Padding="{TemplateBinding Padding}"> |
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
<Panel> |
||||
Content="{TemplateBinding Content}" |
<ContentPresenter Name="PART_ContentPresenter" |
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
ContentTemplate="{TemplateBinding ContentTemplate}" |
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
Content="{TemplateBinding Content}" |
||||
Padding="{TemplateBinding Padding}"/> |
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
||||
|
TextBlock.FontFamily="{TemplateBinding FontFamily}" |
||||
|
TextBlock.FontSize="{TemplateBinding FontSize}" |
||||
|
TextBlock.FontWeight="{TemplateBinding FontWeight}" /> |
||||
|
<Border Name="PART_SelectedPipe" |
||||
|
Height="2" |
||||
|
Margin="0,0,0,2" |
||||
|
HorizontalAlignment="Stretch" |
||||
|
VerticalAlignment="Bottom" |
||||
|
CornerRadius="{DynamicResource ControlCornerRadius}" |
||||
|
Background="{DynamicResource PivotHeaderItemSelectedPipeFill}" /> |
||||
|
</Panel> |
||||
|
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
|
|
||||
|
|
||||
|
<!-- Nornal state --> |
||||
|
<Style Selector="TabStripItem /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{Binding $parent[TabStripItem].Background}" /> |
||||
|
</Style> |
||||
|
<Style Selector="TabStripItem /template/ Border#PART_SelectedPipe"> |
||||
|
<Setter Property="IsVisible" Value="False" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Selected state --> |
||||
|
<!-- We don't use selector to PART_LayoutRoot, so developer can override selected item background with TabStripItem.Background --> |
||||
<Style Selector="TabStripItem:selected"> |
<Style Selector="TabStripItem:selected"> |
||||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> |
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelected}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelected}" /> |
||||
|
</Style> |
||||
|
<Style Selector="TabStripItem:selected /template/ Border#PART_SelectedPipe"> |
||||
|
<Setter Property="IsVisible" Value="True" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- PointerOver state --> |
||||
|
<Style Selector="TabStripItem:pointerover /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Selected PointerOver state --> |
||||
|
<Style Selector="TabStripItem:selected:pointerover /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Pressed state --> |
||||
|
<Style Selector="TabStripItem:pressed /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundUnselectedPressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundUnselectedPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Selected Pressed state --> |
||||
|
<Style Selector="TabStripItem:pressed /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundSelectedPressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundSelectedPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Disabled state --> |
||||
|
<Style Selector="TabStripItem:disabled /template/ Border#PART_LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource PivotHeaderItemBackgroundDisabled}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource PivotHeaderItemForegroundDisabled}" /> |
||||
</Style> |
</Style> |
||||
</Styles> |
</Styles> |
||||
|
|||||
Loading…
Reference in new issue