-
Notifications
You must be signed in to change notification settings - Fork 69
/
TabStripItem.axaml
70 lines (65 loc) · 3.88 KB
/
TabStripItem.axaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:materialAnimationAssists="clr-namespace:Material.Styles.Additional.MaterialAnimationAssists">
<ControlTheme x:Key="MaterialTabStripItem" TargetType="TabStripItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="assists:TabControlAssist.TabHeaderForeground"
Value="{Binding Path=(assists:TabControlAssist.TabHeaderInactiveBrush),
RelativeSource={RelativeSource AncestorType=TabStrip}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Name="ItemContent" Background="{TemplateBinding Background}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" MinHeight="48" MinWidth="90">
<ripple:RippleEffect
RippleFill="{Binding Path=(assists:TabControlAssist.TabHeaderHighlightBrush),
RelativeSource={RelativeSource AncestorType=TabStrip}}">
<ContentPresenter Name="headerContent"
Margin="24,12,24,12" HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
TextBlock.Foreground="{Binding Path=(assists:TabControlAssist.TabHeaderForeground), RelativeSource={RelativeSource TemplatedParent}}" />
</ripple:RippleEffect>
<Border Name="border"
Background="{Binding Path=(assists:TabControlAssist.TabHeaderHighlightBrush), RelativeSource={RelativeSource AncestorType=TabStrip}}"
Height="2" Width="0" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style Selector="^:disabled">
<Setter Property="Opacity" Value="0.23" />
</Style>
<Style Selector="^:selected">
<Setter Property="assists:TabControlAssist.TabHeaderForeground"
Value="{Binding Path=(assists:TabControlAssist.TabHeaderHighlightBrush), RelativeSource={RelativeSource AncestorType=TabStrip}}" />
</Style>
<Style Selector="^:selected /template/ Border#border">
<Setter Property="materialAnimationAssists:MaterialAnimationAssist.ReverseAfterEndAnimation">
<Animation Duration="0:0:0.15" FillMode="Both" Easing="CircularEaseOut">
<KeyFrame Cue="0%">
<Setter Property="Width" Value="0" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Width" Value="{Binding $parent[Control].Bounds.Width}" />
</KeyFrame>
</Animation>
</Setter>
</Style>
<Style Selector="^:not(:selected) /template/ ContentPresenter#headerContent">
<Setter Property="Opacity"
Value="{Binding Path=(assists:TabControlAssist.TabHeaderInactiveOpacity), RelativeSource={RelativeSource AncestorType=TabStrip}}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type TabStripItem}" TargetType="TabStripItem"
BasedOn="{StaticResource MaterialTabStripItem}" />
</ResourceDictionary>