C# wpf设置带触发器的单选按钮的样式

C# wpf设置带触发器的单选按钮的样式,c#,wpf,C#,Wpf,我正在尝试为单选按钮构建一个模板,如选中时会发生更改 <RadioButton GroupName="NewTabButons" Content="{Binding TabTitle}" Background="{StaticResource CanvasBackgroundColour}" Command=... CommandParameter=...> <RadioButton.BorderBrush>..

我正在尝试为
单选按钮
构建一个模板,如选中时会发生更改

<RadioButton GroupName="NewTabButons" Content="{Binding TabTitle}"
             Background="{StaticResource CanvasBackgroundColour}"
             Command=... CommandParameter=...>
    <RadioButton.BorderBrush>...</RadioButton.BorderBrush>
    <RadioButton.Template>
        <ControlTemplate TargetType="RadioButton">
            <ControlTemplate.Triggers>
                <Trigger Property="IsChecked" Value="true">
                    <Setter Property="Control.Background" Value="AliceBlue" />
                    <Setter Property="Control.Foreground" Value="{StaticResource TabTextColourActive}" />
                </Trigger>
            </ControlTemplate.Triggers>
            <Border Height=... Width=... Padding=... VerticalAlignment=...
                    Background="{TemplateBinding Background}"
                    BorderThickness="0 0 0 10"
                    BorderBrush="{TemplateBinding BorderBrush}">
                <Border.Style>
                    <Style BasedOn="{StaticResource Text-Light}" />
                </Border.Style>
                <StackPanel Orientation="Horizontal"
                            VerticalAlignment="Center">
                    <ContentPresenter HorizontalAlignment="Left" 
                                      VerticalAlignment="Center" />
                    <Label Style="{StaticResource TabTextChevron}" />
                </StackPanel>
            </Border>
        </ControlTemplate>
    </RadioButton.Template>
</RadioButton>

...
选中后,我想更改
边框的背景,因为这是构成控件的可视元素

我已将触发器放在
控制模板上
,以便在属性
IsChecked
上触发。但是,这意味着我不能从触发器中设置
边框的样式(例如)

如果将触发器放在边框上,则无法获取
IsChecked
属性,因为
边框上没有此类内容


如果需要在选中
IsChecked
时触发
单选按钮,应如何对其进行模板化?

为边框设置名称

<Border x:Name="RadioBorder" Height=... Width=... 
当我将其移除并以样式设置背景时(如下所示)


IsChecked的触发器在模板中没有更改的情况下工作

<Trigger Property="IsChecked" Value="true">
    <Setter TargetName="RadioBorder" Property="Background" Value="Red"/>
</Trigger>
Background="{StaticResource CanvasBackgroundColour}"
<RadioButton.Style>
     <Style TargetType="RadioButton">
         <Setter Property="Background" Value="{StaticResource CanvasBackgroundColour}" />
     </Style>
</RadioButton.Style>