Animate RenderTransformOrigin
本文关键字:RenderTransformOrigin Animate | 更新日期: 2023-09-27 18:10:44
我想在一个xaml storyboard
中修改RenderTransformOrigin
。这个值不能动画化,立即改变也可以。下面的代码不起作用:
<Storyboard x:Key="StoryboardFadeIn">
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransformOrigin).(Point.X)" Storyboard.TargetName="UserControl" To="0"/>
<DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransformOrigin).(Point.Y)" Storyboard.TargetName="UserControl" To="0"/>
</Storyboard>
是否可以在动画中更改此属性(仅使用xaml)?
错误代码:
The property "X" is not a DependencyProperty. To be used in markup, non-attached properties must be exposed on the target type with an accessible instance property "X".
我不确定你是否可以使用DoubleAnimation
动画X
和Y
点结构,但你应该能够使用PointAnimation
动画RenderTransformOrigin
的例子:
<Storyboard x:Key="StoryboardFadeIn">
<PointAnimation Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="UserControl" To="0,0"/>
</Storyboard>