RadioButtonStyle.xaml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:local="clr-namespace:Compdfkit_Tools.Asset.Styles">
  4. <Style x:Key="TCIRadioButtonStyle" TargetType="RadioButton">
  5. <Setter Property="Background" Value="Red"></Setter>
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="{x:Type local:TCIRadioButton}">
  9. <Grid HorizontalAlignment="Left">
  10. <Grid.ColumnDefinitions>
  11. <ColumnDefinition Width="40"></ColumnDefinition>
  12. <ColumnDefinition Width="auto"></ColumnDefinition>
  13. </Grid.ColumnDefinitions>
  14. <Grid Grid.RowSpan="2">
  15. <Ellipse x:Name="RadioEllipse"
  16. Width="20"
  17. Height="20"
  18. Fill="White"
  19. Stroke="{TemplateBinding BorderBrush}"
  20. StrokeThickness="1"/>
  21. <Ellipse x:Name="InnerEllipse"
  22. Width="15"
  23. Height="15"
  24. Fill="Black"
  25. Opacity="0"/>
  26. </Grid>
  27. <Border x:Name="Border" BorderBrush="#1A000000" BorderThickness="1" Grid.Column="1" CornerRadius="1" Padding="10" HorizontalAlignment="Stretch" Background="Transparent">
  28. <Grid>
  29. <Grid.ColumnDefinitions>
  30. <ColumnDefinition></ColumnDefinition>
  31. <ColumnDefinition></ColumnDefinition>
  32. </Grid.ColumnDefinitions>
  33. <!-- 这里是 ContentPresenter -->
  34. <Grid x:Name="PART_IconGrid" Width="32" Margin="0,0,10,0">
  35. <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
  36. </Grid>
  37. <Grid Name="TextGd" Grid.Column="1" Width="{TemplateBinding TextWidth}" VerticalAlignment="Center">
  38. <Grid.RowDefinitions>
  39. <RowDefinition Height="25"></RowDefinition>
  40. <RowDefinition></RowDefinition>
  41. </Grid.RowDefinitions>
  42. <TextBlock Text="{TemplateBinding Title}" TextWrapping="Wrap" FontSize="14" FontWeight="Bold" FontFamily="Segoe UI"></TextBlock>
  43. <TextBlock Grid.Row="1" Text="{TemplateBinding Description}" TextWrapping="Wrap" FontSize="12" FontWeight="Normal" FontFamily="Segoe UI"></TextBlock>
  44. </Grid>
  45. </Grid>
  46. </Border>
  47. </Grid>
  48. <ControlTemplate.Triggers>
  49. <Trigger Property="IsChecked" Value="True">
  50. <Setter TargetName="InnerEllipse" Property="Opacity" Value="1"/>
  51. </Trigger>
  52. <Trigger Property="IsMouseOver" Value="True">
  53. <Setter TargetName="RadioEllipse" Property="Stroke" Value="DodgerBlue"/>
  54. <Setter TargetName="InnerEllipse" Property="Stroke" Value="DodgerBlue"/>
  55. <Setter TargetName="Border" Property="Background" Value="AliceBlue"></Setter>
  56. </Trigger>
  57. </ControlTemplate.Triggers>
  58. </ControlTemplate>
  59. </Setter.Value>
  60. </Setter>
  61. </Style>
  62. </ResourceDictionary>