WPF中轻量级处理动画资源?
我创建了一个循环处理动画,类似于Chrome浏览器选项卡上看到的...我想在整个应用程序中使用它,因此决定将其作为资源..但是..我想知道什么是在我的应用程序中轻松使用此动画资源的最佳方式/练习...下面是我处理动画的xaml代码。
它应该用作DataTemplate还是ControlTemplate?
<Grid>
<Grid.Resources>
<Storyboard x:Key="LoadingAnimation" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(c:Arc.EndAngle)" Storyboard.TargetName="arc">
<EasingDoubleKeyFrame KeyTime="0" Value="90"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-90"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="-270"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(c:Arc.StartAngle)" Storyboard.TargetName="arc">
<EasingDoubleKeyFrame KeyTime="0" Value="-90"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-270"/>
<EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="-450"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Grid.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource LoadingAnimation}"/>
</EventTrigger>
</Grid.Triggers>
<c:Arc x:Name="arcbackground" StartAngle="0" EndAngle="359.9" Stroke="#FFE0E0E0" StrokeThickness="8"/>
<c:Arc x:Name="arc" Stroke="{StaticResource BlueGradientBrush}" StrokeThickness="8"/>
没有找到相关结果
已邀请:
1 个回复
镶骄册筷
它的代码隐藏: