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
に適用されます。 (スタイルの他のプロパティが適用されています)RadioButton
にPadding
を明示的に指定すると、それは機能します。私はここで何が欠けていますか?
EDIT: サンプルRadioButton
インスタンス:
<RadioButton Grid.Column="4" Content="Iowa" GroupName="Facility"
IsChecked="{Binding IowaFacilityChecked1, UpdateSourceTrigger=PropertyChanged,
Mode=TwoWay}"/>
TargetType="{x:Type RadioButton}"
に、私はこれらのスタイルを使用して、他のUI要素を持っているようにすることはできません。 – ConradあなたはUI構造を共有できますか?どのようにラジオボタンが宣言され、どこに? –
あなたが探しているものがわからない - 「UIの構造」はどういう意味ですか?一つは '' RadioButton''を宣言しません。 – Conrad