自定义控件故事板模板绑定不起作用 - XAML C#

Custom Control Storyboard Template Binding Not Working - XAML C#

我创建了一个自定义控件,它有一些依赖属性,我还需要将这些值分配给 ControlTemplate 中的故事板。

这是我的代码的开头 Control Template:

 <ControlTemplate TargetType="local:RingPresenter">
                <Grid x:Name="RootGrid">
                    <Grid.Resources>
                        <Storyboard x:Key="StatisticUpdateAnnimation">
                            <DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(RingSlice.EndAngle)" Storyboard.TargetName="ringSlice">
                                <EasingDoubleKeyFrame KeyTime="0" Value="45"/>
                                <EasingDoubleKeyFrame KeyTime="0:0:2.2" Value="{TemplateBinding Angle}">

重要的部分是 Value={TemplateBinding Angle}" - 值已成功应用到我的

 <helper:RingSlice InnerRadius="100" Radius="150"  StartAngle="0" EndAngle="{TemplateBinding Angle}"  Fill="DarkCyan" x:Name="ringSlice">
                        </helper:RingSlice>

... 这是我的控件模板的一部分 ,但在故事板中该值保持为 0。调试器说 Angle 具有正确的值它适用于我的 Ringslice,甚至元数据也应该是 45。

为什么这个值没有应用到我的故事板?我该如何解决这个问题?

如有疑问,请将 EndAngle="{TemplateBinding Angle}" 换成 EndAngle="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Angle}"

TemplateBinding 快速且有用,但并不总是具有最强的能力来传递它所绑定的信息,原因我完全无法理解。