-
Notifications
You must be signed in to change notification settings - Fork 6
/
Styles.xaml
136 lines (135 loc) · 8.79 KB
/
Styles.xaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="clr-namespace:ServiceConfigurator">
<SolidColorBrush x:Key="disabledMask" Color="#99000000"/>
<SolidColorBrush x:Key="NormalForeground" Color="#000" />
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFF" Offset="0.0"/>
<GradientStop Color="#CCC" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#DDD" Offset="0.0"/>
<GradientStop Color="#888" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888"/>
<LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#777" Offset="0.0"/>
<GradientStop Color="#000" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#BBB" Offset="0.0"/>
<GradientStop Color="#EEE" Offset="0.1"/>
<GradientStop Color="#EEE" Offset="0.9"/>
<GradientStop Color="#FFF" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#444" Offset="0.0"/>
<GradientStop Color="#888" Offset="1.0"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<Style TargetType="{x:Type loc:ImageButton}" x:Key="{x:Type loc:ImageButton}">
<Setter Property="Margin" Value="4,2" />
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="ShowText" Value="True" />
<Setter Property="ImageLocation" Value="Top" />
<Setter Property="Foreground" Value="{DynamicResource NormalForeground}"/>
<Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type loc:ImageButton}">
<Border x:Name="Border" Padding="3" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
CornerRadius="1" BorderThickness="1" ToolTip="{TemplateBinding ToolTip}" ToolTipService.ShowOnDisabled="True">
<DockPanel x:Name="Container" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Center">
<Image x:Name="PART_img" Source="{TemplateBinding Image}" Stretch="None" SnapsToDevicePixels="True"
IsEnabled="{TemplateBinding IsEnabled}" IsHitTestVisible="False" />
<TextBlock x:Name="PART_text" Text="{TemplateBinding Text}" IsEnabled="{TemplateBinding IsEnabled}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextTrimming="CharacterEllipsis" TextWrapping="Wrap" MaxWidth="{TemplateBinding MaxWidth}" MaxHeight="{TemplateBinding MaxWidth}"
TextAlignment="{TemplateBinding HorizontalAlignment}" />
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="ImageLocation">
<Trigger.Value>
<PlacementMode>Left</PlacementMode>
</Trigger.Value>
<Setter TargetName="PART_img" Property="DockPanel.Dock" Value="Left" />
<Setter TargetName="PART_text" Property="DockPanel.Dock" Value="Right" />
<Setter TargetName="PART_text" Property="Margin" Value="2,0,0,0" />
</Trigger>
<Trigger Property="ImageLocation">
<Trigger.Value>
<PlacementMode>Top</PlacementMode>
</Trigger.Value>
<Setter TargetName="PART_img" Property="DockPanel.Dock" Value="Top" />
<Setter TargetName="PART_text" Property="DockPanel.Dock" Value="Bottom" />
<Setter TargetName="PART_text" Property="Margin" Value="0,2,0,0" />
</Trigger>
<Trigger Property="ImageLocation">
<Trigger.Value>
<PlacementMode>Right</PlacementMode>
</Trigger.Value>
<Setter TargetName="PART_img" Property="DockPanel.Dock" Value="Right" />
<Setter TargetName="PART_text" Property="DockPanel.Dock" Value="Left" />
<Setter TargetName="PART_text" Property="Margin" Value="0,0,2,0" />
</Trigger>
<Trigger Property="ImageLocation">
<Trigger.Value>
<PlacementMode>Bottom</PlacementMode>
</Trigger.Value>
<Setter TargetName="PART_img" Property="DockPanel.Dock" Value="Bottom" />
<Setter TargetName="PART_text" Property="DockPanel.Dock" Value="Top" />
<Setter TargetName="PART_text" Property="Margin" Value="0,0,0,2" />
</Trigger>
<Trigger Property="ShowText" Value="false">
<Setter TargetName="PART_text" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" />
<!--Setter TargetName="PART_img" Property="Opacity" Value="0.5" /-->
<Setter TargetName="Container" Property="OpacityMask" Value="{StaticResource disabledMask}"/>
<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource DefaultedBorderBrush}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource DarkBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource PressedBrush}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource PressedBorderBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>