RadioButtonStyle.xaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style x:Key="ColorfulRadioButtonStyle" TargetType="{x:Type RadioButton}">
  4. <Setter Property="Template">
  5. <Setter.Value>
  6. <ControlTemplate TargetType="{x:Type RadioButton}">
  7. <Grid>
  8. <Ellipse x:Name="BorderEllipse"
  9. Fill="{TemplateBinding Background}"
  10. Stroke="{TemplateBinding BorderBrush}"
  11. StrokeThickness="{TemplateBinding BorderThickness}"
  12. Width="{TemplateBinding Width}"
  13. Height="{TemplateBinding Height}" />
  14. <Ellipse x:Name="InnerEllipse"
  15. Fill="{TemplateBinding Tag}"
  16. StrokeThickness="0"
  17. Width="{Binding ActualWidth, ElementName=BorderEllipse}"
  18. Height="{Binding ActualHeight, ElementName=BorderEllipse}"
  19. Margin="{Binding ActualWidth, ElementName=BorderEllipse}" />
  20. </Grid>
  21. <ControlTemplate.Triggers>
  22. <Trigger Property="IsChecked" Value="True">
  23. <Setter TargetName="BorderEllipse" Property="StrokeThickness" Value="2" />
  24. </Trigger>
  25. <Trigger Property="IsMouseOver" Value="True">
  26. <Setter TargetName="BorderEllipse" Property="StrokeThickness" Value="1" />
  27. </Trigger>
  28. </ControlTemplate.Triggers>
  29. </ControlTemplate>
  30. </Setter.Value>
  31. </Setter>
  32. </Style>
  33. </ResourceDictionary>