RadioButton.xaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
  7. mc:Ignorable="d">
  8. <Style x:Key="Button_RadioButton" TargetType="{x:Type RadioButton}">
  9. <Setter Property="VerticalContentAlignment"
  10. Value="Center" />
  11. <Setter Property="HorizontalContentAlignment"
  12. Value="Center" />
  13. <Setter Property="Background"
  14. Value="LightGray" />
  15. <Setter Property="BorderBrush"
  16. Value="White" />
  17. <Setter Property="BorderThickness"
  18. Value="0" />
  19. <Setter Property="Padding"
  20. Value="10,0" />
  21. <Setter Property="Cursor" Value="Hand"/>
  22. <Setter Property="Foreground" Value="White"/>
  23. <Setter Property="Template">
  24. <Setter.Value>
  25. <ControlTemplate TargetType="{x:Type RadioButton}">
  26. <Grid x:Name="GrdMain">
  27. <Border x:Name="BdrBack"
  28. BorderBrush="{TemplateBinding BorderBrush}"
  29. BorderThickness="{TemplateBinding BorderThickness}"
  30. Background="{StaticResource Button_BG_Unable}"
  31. CornerRadius="5"
  32. />
  33. <Border x:Name="BdrHover"
  34. BorderBrush="Transparent"
  35. BorderThickness="{TemplateBinding BorderThickness}"
  36. Background="Gray"
  37. Opacity="0" />
  38. <Border x:Name="BdrChecked"
  39. BorderBrush="{TemplateBinding BorderBrush}"
  40. BorderThickness="{TemplateBinding BorderThickness}"
  41. Background="{StaticResource Button_BG}"
  42. CornerRadius="5"
  43. Visibility="Collapsed" />
  44. <ContentPresenter x:Name="Content"
  45. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  46. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  47. Margin="{TemplateBinding Padding}"
  48. Content="{TemplateBinding Content}"
  49. TextBlock.Foreground="{TemplateBinding Foreground}" />
  50. </Grid>
  51. <ControlTemplate.Triggers>
  52. <MultiDataTrigger>
  53. </MultiDataTrigger>
  54. <MultiDataTrigger>
  55. <MultiDataTrigger.Conditions>
  56. <Condition Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}"
  57. Value="True" />
  58. <Condition Binding="{Binding IsChecked,RelativeSource={RelativeSource Self}}"
  59. Value="False" />
  60. </MultiDataTrigger.Conditions>
  61. <MultiDataTrigger.EnterActions>
  62. <BeginStoryboard>
  63. <Storyboard>
  64. <DoubleAnimation Storyboard.TargetName="BdrHover"
  65. Storyboard.TargetProperty="Opacity"
  66. To="0.2"
  67. Duration="0:0:0.3" />
  68. </Storyboard>
  69. </BeginStoryboard>
  70. </MultiDataTrigger.EnterActions>
  71. <MultiDataTrigger.ExitActions>
  72. <BeginStoryboard>
  73. <Storyboard>
  74. <DoubleAnimation Storyboard.TargetName="BdrHover"
  75. Storyboard.TargetProperty="Opacity"
  76. Duration="0:0:0.3" />
  77. </Storyboard>
  78. </BeginStoryboard>
  79. </MultiDataTrigger.ExitActions>
  80. </MultiDataTrigger>
  81. <Trigger Property="IsChecked"
  82. Value="True">
  83. <Setter TargetName="BdrChecked"
  84. Property="Visibility"
  85. Value="Visible" />
  86. <Setter Property="IsEnabled" Value="False"/>
  87. </Trigger>
  88. </ControlTemplate.Triggers>
  89. </ControlTemplate>
  90. </Setter.Value>
  91. </Setter>
  92. </Style>
  93. </ResourceDictionary>