0
我想在使用DoubleAnimationUsingKeyFrames和StoryBoard的wpf中創建一個加載器圖像,但我得到這個錯誤 無法解析屬性路徑'(0)中的所有屬性引用。(1)[ 0]。(RotateTransform)」。驗證適用的對象是否支持這些屬性。wpf使用TransformGroup和故事板的圖像動畫
這是我的代碼
<UserControl.Resources>
<Storyboard x:Key="LoaderAnimation">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform)"
Storyboard.TargetName="canvas"
RepeatBehavior="Forever">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="360"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<ei:ControlStoryboardAction Storyboard="{StaticResource LoaderAnimation}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Viewbox x:Name="LayoutRoot" HorizontalAlignment="Left" VerticalAlignment="Top">
<Canvas x:Name="canvas" Height="323" Width="308" RenderTransformOrigin="0.5,0.5">
<Canvas.RenderTransform>
<TransformGroup></TransformGroup>
</Canvas.RenderTransform>
<Ellipse Fill="{Binding Foreground, ElementName=ProgressRing}"
Height="71" Canvas.Left="121" Canvas.Top="21" Width="69" Opacity="0.3"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Height="71" Width="69" Canvas.Left="194" Canvas.Top="52" Opacity="0.4"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Width="69" Height="71" Canvas.Left="221" Canvas.Top="123" Opacity="0.5"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Width="69" Height="71" Canvas.Left="190" Canvas.Top="198" Opacity="0.6"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Height="71" Canvas.Left="121" Canvas.Top="226" Width="69" Opacity="0.7"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Width="69" Height="71" Canvas.Left="48" Canvas.Top="194" Opacity="0.8"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Height="71" Width="69" Canvas.Left="17" Canvas.Top="123" Opacity="0.9"/>
<Ellipse Fill="{Binding Foreground, ElementName=userControl}"
Height="71" Width="69" Canvas.Left="48" Canvas.Top="52" Opacity="1.0"/>
</Canvas>
</Viewbox>
在裏面加入 去掉了錯誤謝謝@Clemens –
Shelly