首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未应用RadioButton样式属性填充

问未应用RadioButton样式属性填充
EN

Stack Overflow用户
提问于 2016-08-05 23:52:49
回答 1查看 292关注 0票数 1

使用.NET框架4.5.1

我在其中一个WPF窗口中设置了以下资源:

代码语言:javascript
复制
<Window.Resources>
    <Style TargetType="{x:Type FrameworkElement}" x:Key="baseStyle">
        <Setter Property="Margin" Value="5"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>
    <Style TargetType="{x:Type FrameworkElement}" x:Key="basePlusEnabled" BasedOn="{StaticResource baseStyle}">
        <Setter Property="IsEnabled" Value="{Binding TestIsRunning, Mode=OneWay}"/>
    </Style>
    <Style TargetType="RadioButton" BasedOn="{StaticResource basePlusEnabled}">
        <Setter Property="Padding" Value="4,-5,0,0"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="Foreground" Value="{Binding TestIsRunning, 
            Converter={StaticResource testIsRunningForegroundConverter}, Mode=OneWay}"/>
    </Style>
</Window.Resources>

但是,窗口中的RadioButton没有应用Padding样式。(将应用该样式中的其他特性。)如果我在每个RadioButton中显式地指定了Padding,那么它就可以工作。这里我漏掉了什么?

编辑:示例RadioButton实例:

代码语言:javascript
复制
<RadioButton Grid.Column="4" Content="Iowa" GroupName="Facility"
    IsChecked="{Binding IowaFacilityChecked1, UpdateSourceTrigger=PropertyChanged, 
    Mode=TwoWay}"/>
EN

回答 1

Stack Overflow用户

发布于 2016-08-06 01:23:35

将TargetType="{x:Type FrameworkElement}"更改为TargetType="{x:Type RadioButton}"

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38793293

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档