为按钮的内容定义样式

Defining style for Button's Content

在我的按钮 ControlTemplate.Resources 中定义的以下通用 Style 有什么问题?

<ControlTemplate x:Key="ZeroButtonTemplate" TargetType="Button">
  <ControlTemplate.Resources>
    <Style TargetType="{x:Type Rectangle}">
      <Style.Triggers>
        <DataTrigger Binding="{Binding IsRunning}" Value="True">
          <Setter Property="Fill" Value="LightGray" />
        </DataTrigger>
        <EventTrigger RoutedEvent="Button.MouseEnter">
          <BeginStoryboard>
            <Storyboard>
              <ColorAnimation From="Black" To="Red" Duration="00:00:00.5" Storyboard.TargetProperty="Fill" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Style.Triggers>
    </Style>
  </ControlTemplate.Resources>

  <ContentPresenter Content="{TemplateBinding Content}" />
</ControlTemplate>

DataTriggerEventTrigger 似乎都不起作用。

为了完成,我的 Button 是这样定义的:

<Button Template="{StaticResource ZeroButtonTemplate}">
  <Button.Content>
    <Rectangle Width="15" Height="15" Fill="Black" />
  </Button.Content>
</Button>

将动画的目标 属性 更改为 Fill.Color

<ColorAnimation From="Black" To="Red" Duration="00:00:00.5" Storyboard.TargetProperty="Fill.Color" />