This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathOcticonButton.xaml
More file actions
106 lines (103 loc) · 6.53 KB
/
Copy pathOcticonButton.xaml
File metadata and controls
106 lines (103 loc) · 6.53 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI">
<Style x:Key="OcticonButton" TargetType="{x:Type ui:OcticonButton}">
<Setter Property="Focusable" Value="True"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ui:OcticonButton">
<Grid x:Name="content" Margin="{TemplateBinding Margin}" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Path" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.5"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused"/>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="Background"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
SnapsToDevicePixels="True"/>
<Rectangle x:Name="DisabledVisualElement"
Fill="#FFFCFCFC"
IsHitTestVisible="False"
Opacity="0"
SnapsToDevicePixels="True"/>
<Border x:Name="MouseOverBorder"
Background="{DynamicResource VsBrush.CommandBarHover}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
Opacity="0"
SnapsToDevicePixels="True"/>
<Border x:Name="PressedBorder"
Background="{DynamicResource VsBrush.CommandBarMouseDownBackgroundBegin}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
Opacity="0"
SnapsToDevicePixels="True"/>
<Border x:Name="DefaultVisualElement"
Background="Transparent"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
Opacity="0"
SnapsToDevicePixels="True"/>
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="16" Height="16">
<Border BorderBrush="Transparent" BorderThickness="1">
<ui:OcticonPath x:Name="Path"
Height="16"
Fill="{TemplateBinding Foreground}"
Icon="{TemplateBinding Icon}"
SnapsToDevicePixels="True"/>
</Border>
</Viewbox>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="True">
<Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="DefaultVisualElement" Property="Opacity" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style BasedOn="{StaticResource OcticonButton}" TargetType="{x:Type ui:OcticonButton}"/>
</ResourceDictionary>