我有以下 xaml 来显示旋转Ellipse
:
<Ellipse x:Name="ellipse"
Stroke="{StaticResource _SpinnerGradientBrush}"
StrokeThickness="20"
RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<RotateTransform Angle="0" />
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Triggers>
<EventTrigger RoutedEvent="Ellipse.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="ellipse"
Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"
Duration="0:0:4"
RepeatBehavior="Forever">
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="359" KeyTime="0:0:4" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
窗口将按预期显示,但动画永远不会开始。我已经在 Blend 中进行过这项工作,但由于某种原因,当我在我的应用程序中实际使用 xaml 时它不起作用。如果有人有任何想法,我将不胜感激。