WPF : 14. RadioButton을 ToggleButton형태로 만드는 법
Template을 따로 정의하지 않고, ToggleButton처럼 보이는 RadioButton을 만들여면, Style에 ToggleButton타입을 지정하면 된다.
<RadioButton Content="라디오 토글 버튼"
Style="{StaticResource {x:Type ToggleButton}}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>

추가적은 속성을 스타일에 추가하려면 BaseOn속성에 타입을 지정해주면 된다.
<StackPanel.Resources>
<Style x:Key="toggleBtn" TargetType="{x:Type RadioButton}"
BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Foreground" Value="White"/>
</Style>
</StackPanel.Resources>
<RadioButton Content="라디오 토글 버튼"
Style="{StaticResource toggleBtn}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
댓글남기기