当前位置:   article > 正文

RadioButton选定显示控件的Style_radiobutton style

radiobutton style
 <!--控件绑定RButton的Uid即可实现选定显示-->
  <Style x:Key="RButton" TargetType="{x:Type RadioButton}">
            <Setter Property="Margin" Value="10"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RadioButton}">
                        <Border x:Name="bd" CornerRadius="15">
                            <TextBlock x:Name="tb" Margin="20,5" TextWrapping="Wrap" 
                                       Text="{TemplateBinding Content}" HorizontalAlignment="Center" 
                                       VerticalAlignment="Center" Height="Auto" FontSize="24" Foreground="#FF0774E5" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter Property="Background" TargetName="bd" Value="#FF0774E5"/>
                                <Setter Property="Foreground" TargetName="tb" Value="Snow"/>
                                <Setter Property="Uid"  Value="Visible"/>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter Property="Uid"  Value="Hidden"/>
                            </Trigger>
                            <!--多条件触发-->
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="IsChecked" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="bd" Value="#B20774E5"/>
                                <Setter Property="Foreground" TargetName="tb" Value="Snow"/>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/733664
推荐阅读
相关标签