回答編集履歴
2
見直しキャンペーン中
answer
CHANGED
@@ -1,101 +1,101 @@
|
|
1
|
-
これで解決するかは不明ですが、Windows 10 & Visual Studio 2019で出したStyleを提示しておきます。
|
2
|
-
|
3
|
-

|
4
|
-
```
|
5
|
-
<Window
|
6
|
-
x:Class="Questions349003.MainWindow"
|
7
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
8
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
9
|
-
Width="800"
|
10
|
-
Height="450">
|
11
|
-
<Window.Resources>
|
12
|
-
<Style x:Key="FocusVisual">
|
13
|
-
<Setter Property="Control.Template">
|
14
|
-
<Setter.Value>
|
15
|
-
<ControlTemplate>
|
16
|
-
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
17
|
-
</ControlTemplate>
|
18
|
-
</Setter.Value>
|
19
|
-
</Setter>
|
20
|
-
</Style>
|
21
|
-
<Style x:Key="OptionMarkFocusVisual">
|
22
|
-
<Setter Property="Control.Template">
|
23
|
-
<Setter.Value>
|
24
|
-
<ControlTemplate>
|
25
|
-
<Rectangle Margin="14,0,0,0" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
26
|
-
</ControlTemplate>
|
27
|
-
</Setter.Value>
|
28
|
-
</Setter>
|
29
|
-
</Style>
|
30
|
-
<SolidColorBrush x:Key="RadioButton.Static.Background" Color="#FFFFFFFF"/>
|
31
|
-
<SolidColorBrush x:Key="RadioButton.Static.Border" Color="#FF707070"/>
|
32
|
-
<SolidColorBrush x:Key="RadioButton.Static.Glyph" Color="#FF212121"/>
|
33
|
-
<SolidColorBrush x:Key="RadioButton.MouseOver.Background" Color="#FFF3F9FF"/>
|
34
|
-
<SolidColorBrush x:Key="RadioButton.MouseOver.Border" Color="#FF5593FF"/>
|
35
|
-
<SolidColorBrush x:Key="RadioButton.MouseOver.Glyph" Color="#FF212121"/>
|
36
|
-
<SolidColorBrush x:Key="RadioButton.Pressed.Background" Color="#FFD9ECFF"/>
|
37
|
-
<SolidColorBrush x:Key="RadioButton.Pressed.Border" Color="#FF3C77DD"/>
|
38
|
-
<SolidColorBrush x:Key="RadioButton.Pressed.Glyph" Color="#FF212121"/>
|
39
|
-
<SolidColorBrush x:Key="RadioButton.Disabled.Background" Color="#FFE6E6E6"/>
|
40
|
-
<SolidColorBrush x:Key="RadioButton.Disabled.Border" Color="#FFBCBCBC"/>
|
41
|
-
<SolidColorBrush x:Key="RadioButton.Disabled.Glyph" Color="#FF707070"/>
|
42
|
-
<Style TargetType="{x:Type RadioButton}">
|
43
|
-
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
44
|
-
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
|
45
|
-
<Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
|
46
|
-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
47
|
-
<Setter Property="BorderThickness" Value="1"/>
|
48
|
-
<Setter Property="Template">
|
49
|
-
<Setter.Value>
|
50
|
-
<ControlTemplate TargetType="{x:Type RadioButton}">
|
51
|
-
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
|
52
|
-
<Grid.ColumnDefinitions>
|
53
|
-
<ColumnDefinition Width="Auto"/>
|
54
|
-
<ColumnDefinition Width="*"/>
|
55
|
-
</Grid.ColumnDefinitions>
|
56
|
-
<Border x:Name="radioButtonBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
57
|
-
<Grid x:Name="markGrid" Margin="2">
|
58
|
-
<Ellipse x:Name="optionMark" Fill="{StaticResource RadioButton.Static.Glyph}" MinHeight="6" MinWidth="6" Opacity="0"/>
|
59
|
-
</Grid>
|
60
|
-
</Border>
|
61
|
-
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
62
|
-
</Grid>
|
63
|
-
<ControlTemplate.Triggers>
|
64
|
-
<Trigger Property="HasContent" Value="true">
|
65
|
-
<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
|
66
|
-
<Setter Property="Padding" Value="4,-1,0,0"/>
|
67
|
-
</Trigger>
|
68
|
-
<Trigger Property="IsMouseOver" Value="true">
|
69
|
-
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
70
|
-
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Border}"/>
|
71
|
-
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.MouseOver.Glyph}"/>
|
72
|
-
</Trigger>
|
73
|
-
<Trigger Property="IsEnabled" Value="false">
|
74
|
-
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Background}"/>
|
75
|
-
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Border}"/>
|
76
|
-
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Disabled.Glyph}"/>
|
77
|
-
</Trigger>
|
78
|
-
<Trigger Property="IsPressed" Value="true">
|
79
|
-
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background}"/>
|
80
|
-
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
|
81
|
-
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph}"/>
|
82
|
-
</Trigger>
|
83
|
-
<Trigger Property="IsChecked" Value="true">
|
84
|
-
<Setter Property="Opacity" TargetName="optionMark" Value="1"/>
|
85
|
-
</Trigger>
|
86
|
-
<Trigger Property="IsChecked" Value="{x:Null}">
|
87
|
-
<Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
|
88
|
-
</Trigger>
|
89
|
-
</ControlTemplate.Triggers>
|
90
|
-
</ControlTemplate>
|
91
|
-
</Setter.Value>
|
92
|
-
</Setter>
|
93
|
-
</Style>
|
94
|
-
</Window.Resources>
|
95
|
-
<Grid>
|
96
|
-
<RadioButton Content="Content" />
|
97
|
-
</Grid>
|
98
|
-
</Window>
|
99
|
-
```
|
100
|
-
|
1
|
+
これで解決するかは不明ですが、Windows 10 & Visual Studio 2019で出したStyleを提示しておきます。
|
2
|
+
|
3
|
+

|
4
|
+
```xml
|
5
|
+
<Window
|
6
|
+
x:Class="Questions349003.MainWindow"
|
7
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
8
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
9
|
+
Width="800"
|
10
|
+
Height="450">
|
11
|
+
<Window.Resources>
|
12
|
+
<Style x:Key="FocusVisual">
|
13
|
+
<Setter Property="Control.Template">
|
14
|
+
<Setter.Value>
|
15
|
+
<ControlTemplate>
|
16
|
+
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
17
|
+
</ControlTemplate>
|
18
|
+
</Setter.Value>
|
19
|
+
</Setter>
|
20
|
+
</Style>
|
21
|
+
<Style x:Key="OptionMarkFocusVisual">
|
22
|
+
<Setter Property="Control.Template">
|
23
|
+
<Setter.Value>
|
24
|
+
<ControlTemplate>
|
25
|
+
<Rectangle Margin="14,0,0,0" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
26
|
+
</ControlTemplate>
|
27
|
+
</Setter.Value>
|
28
|
+
</Setter>
|
29
|
+
</Style>
|
30
|
+
<SolidColorBrush x:Key="RadioButton.Static.Background" Color="#FFFFFFFF"/>
|
31
|
+
<SolidColorBrush x:Key="RadioButton.Static.Border" Color="#FF707070"/>
|
32
|
+
<SolidColorBrush x:Key="RadioButton.Static.Glyph" Color="#FF212121"/>
|
33
|
+
<SolidColorBrush x:Key="RadioButton.MouseOver.Background" Color="#FFF3F9FF"/>
|
34
|
+
<SolidColorBrush x:Key="RadioButton.MouseOver.Border" Color="#FF5593FF"/>
|
35
|
+
<SolidColorBrush x:Key="RadioButton.MouseOver.Glyph" Color="#FF212121"/>
|
36
|
+
<SolidColorBrush x:Key="RadioButton.Pressed.Background" Color="#FFD9ECFF"/>
|
37
|
+
<SolidColorBrush x:Key="RadioButton.Pressed.Border" Color="#FF3C77DD"/>
|
38
|
+
<SolidColorBrush x:Key="RadioButton.Pressed.Glyph" Color="#FF212121"/>
|
39
|
+
<SolidColorBrush x:Key="RadioButton.Disabled.Background" Color="#FFE6E6E6"/>
|
40
|
+
<SolidColorBrush x:Key="RadioButton.Disabled.Border" Color="#FFBCBCBC"/>
|
41
|
+
<SolidColorBrush x:Key="RadioButton.Disabled.Glyph" Color="#FF707070"/>
|
42
|
+
<Style TargetType="{x:Type RadioButton}">
|
43
|
+
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
44
|
+
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
|
45
|
+
<Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
|
46
|
+
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
47
|
+
<Setter Property="BorderThickness" Value="1"/>
|
48
|
+
<Setter Property="Template">
|
49
|
+
<Setter.Value>
|
50
|
+
<ControlTemplate TargetType="{x:Type RadioButton}">
|
51
|
+
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
|
52
|
+
<Grid.ColumnDefinitions>
|
53
|
+
<ColumnDefinition Width="Auto"/>
|
54
|
+
<ColumnDefinition Width="*"/>
|
55
|
+
</Grid.ColumnDefinitions>
|
56
|
+
<Border x:Name="radioButtonBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
57
|
+
<Grid x:Name="markGrid" Margin="2">
|
58
|
+
<Ellipse x:Name="optionMark" Fill="{StaticResource RadioButton.Static.Glyph}" MinHeight="6" MinWidth="6" Opacity="0"/>
|
59
|
+
</Grid>
|
60
|
+
</Border>
|
61
|
+
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
62
|
+
</Grid>
|
63
|
+
<ControlTemplate.Triggers>
|
64
|
+
<Trigger Property="HasContent" Value="true">
|
65
|
+
<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
|
66
|
+
<Setter Property="Padding" Value="4,-1,0,0"/>
|
67
|
+
</Trigger>
|
68
|
+
<Trigger Property="IsMouseOver" Value="true">
|
69
|
+
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
70
|
+
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Border}"/>
|
71
|
+
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.MouseOver.Glyph}"/>
|
72
|
+
</Trigger>
|
73
|
+
<Trigger Property="IsEnabled" Value="false">
|
74
|
+
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Background}"/>
|
75
|
+
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Border}"/>
|
76
|
+
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Disabled.Glyph}"/>
|
77
|
+
</Trigger>
|
78
|
+
<Trigger Property="IsPressed" Value="true">
|
79
|
+
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background}"/>
|
80
|
+
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
|
81
|
+
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph}"/>
|
82
|
+
</Trigger>
|
83
|
+
<Trigger Property="IsChecked" Value="true">
|
84
|
+
<Setter Property="Opacity" TargetName="optionMark" Value="1"/>
|
85
|
+
</Trigger>
|
86
|
+
<Trigger Property="IsChecked" Value="{x:Null}">
|
87
|
+
<Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
|
88
|
+
</Trigger>
|
89
|
+
</ControlTemplate.Triggers>
|
90
|
+
</ControlTemplate>
|
91
|
+
</Setter.Value>
|
92
|
+
</Setter>
|
93
|
+
</Style>
|
94
|
+
</Window.Resources>
|
95
|
+
<Grid>
|
96
|
+
<RadioButton Content="Content" />
|
97
|
+
</Grid>
|
98
|
+
</Window>
|
99
|
+
```
|
100
|
+
|
101
101
|
出力の際に「すべてに適用」にしておくと、Styleをつけて回る手間が省けます。
|
1
Windows 10
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
これで解決するかは不明ですが、Visual Studio 2019で出したStyleを提示しておきます。
|
1
|
+
これで解決するかは不明ですが、Windows 10 & Visual Studio 2019で出したStyleを提示しておきます。
|
2
2
|
|
3
3
|

|
4
4
|
```xaml
|