質問編集履歴
1
ButtonListStyleの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,9 +18,7 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
```
|
21
|
+
```XAML
|
22
|
-
|
23
|
-
|
24
22
|
|
25
23
|
<StackPanel Margin="20" VerticalAlignment="Center" DataContext="{Binding Source={StaticResource oHogePage}, Path=Sample}">
|
26
24
|
|
@@ -54,6 +52,108 @@
|
|
54
52
|
|
55
53
|
|
56
54
|
|
55
|
+
また、下記がButtonListStyleの中身です。
|
56
|
+
|
57
|
+
```XAML
|
58
|
+
|
59
|
+
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
|
60
|
+
|
61
|
+
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
|
62
|
+
|
63
|
+
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="#FFBEE6FD"/>
|
64
|
+
|
65
|
+
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
|
66
|
+
|
67
|
+
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
|
68
|
+
|
69
|
+
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
|
70
|
+
|
71
|
+
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
|
72
|
+
|
73
|
+
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
|
74
|
+
|
75
|
+
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
|
76
|
+
|
77
|
+
<Style x:Key="ButtonListStyle" TargetType="{x:Type Button}">
|
78
|
+
|
79
|
+
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
80
|
+
|
81
|
+
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
|
82
|
+
|
83
|
+
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
|
84
|
+
|
85
|
+
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
86
|
+
|
87
|
+
<Setter Property="BorderThickness" Value="1"/>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<Setter Property="Padding" Value="1"/>
|
92
|
+
|
93
|
+
<Setter Property="Template">
|
94
|
+
|
95
|
+
<Setter.Value>
|
96
|
+
|
97
|
+
<ControlTemplate TargetType="{x:Type Button}">
|
98
|
+
|
99
|
+
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
100
|
+
|
101
|
+
<StackPanel Orientation="Horizontal">
|
102
|
+
|
103
|
+
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
104
|
+
|
105
|
+
</StackPanel>
|
106
|
+
|
107
|
+
</Border>
|
108
|
+
|
109
|
+
<ControlTemplate.Triggers>
|
110
|
+
|
111
|
+
<Trigger Property="IsDefaulted" Value="true">
|
112
|
+
|
113
|
+
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
|
114
|
+
|
115
|
+
</Trigger>
|
116
|
+
|
117
|
+
<Trigger Property="IsMouseOver" Value="true">
|
118
|
+
|
119
|
+
<Setter Property="Background" TargetName="border" Value="DarkGray"/>
|
120
|
+
|
121
|
+
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
|
122
|
+
|
123
|
+
</Trigger>
|
124
|
+
|
125
|
+
<Trigger Property="IsPressed" Value="true">
|
126
|
+
|
127
|
+
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
|
128
|
+
|
129
|
+
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
|
130
|
+
|
131
|
+
</Trigger>
|
132
|
+
|
133
|
+
<Trigger Property="IsEnabled" Value="false">
|
134
|
+
|
135
|
+
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
|
136
|
+
|
137
|
+
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
|
138
|
+
|
139
|
+
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
|
140
|
+
|
141
|
+
</Trigger>
|
142
|
+
|
143
|
+
</ControlTemplate.Triggers>
|
144
|
+
|
145
|
+
</ControlTemplate>
|
146
|
+
|
147
|
+
</Setter.Value>
|
148
|
+
|
149
|
+
</Setter>
|
150
|
+
|
151
|
+
</Style>
|
152
|
+
|
153
|
+
```
|
154
|
+
|
155
|
+
|
156
|
+
|
57
157
|
### 動作環境
|
58
158
|
|
59
159
|
・ .NET Frame Work 4.5
|