2016-08-05 6 views
1

を適用されていないのRadioButtonのスタイルプロパティのパディングが

私はWPFのWindowsのいずれかに設定され、次のリソースを持っている:

<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> 

しかし、PaddingスタイルではありませんウィンドウのRadioButtonに適用されます。 (スタイルの他のプロパティが適用されています)RadioButtonPaddingを明示的に指定すると、それは機能します。私はここで何が欠けていますか?

EDIT: サンプルRadioButtonインスタンス:

<RadioButton Grid.Column="4" Content="Iowa" GroupName="Facility" 
    IsChecked="{Binding IowaFacilityChecked1, UpdateSourceTrigger=PropertyChanged, 
    Mode=TwoWay}"/> 

答えて

0

変更TargetType="{x:Type FrameworkElement}"

+0

TargetType="{x:Type RadioButton}"に、私はこれらのスタイルを使用して、他のUI要素を持っているようにすることはできません。 – Conrad

+0

あなたはUI構造を共有できますか?どのようにラジオボタンが宣言され、どこに? –

+0

あなたが探しているものがわからない - 「UIの構造」はどういう意味ですか?一つは '' RadioButton''を宣言しません。 – Conrad

関連する問題