Reputation: 2582
I would like to modify RenderTransformOrigin
in a xaml storyboard
. The value must not be animated, a immediately change would be also fine.
The following code dosn't work:
<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>
Is it possible to change this property in an animation (using only xaml)?
Errorcode:
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".
Upvotes: 3
Views: 1220
Reputation: 43596
I'm not sure if you can Animate the X
and Y
of a point structure using DoubleAnimation
, but you should be able to animate the RenderTransformOrigin
using a PointAnimation
Example:
<Storyboard x:Key="StoryboardFadeIn">
<PointAnimation Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="UserControl" To="0,0"/>
</Storyboard>
Upvotes: 7