Snap to "To" in storyboard

I will try to make it as simple as possible.

I want to do this:

<Storyboard x:Name="MoveToLocation">
   <DoubleAnimation Duration="0:0:0.5" To="{Binding X}" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
</Storyboard>

As you may have noticed, binding to the To property does not work. It seems to take only static values.

How to make this animation with MVVM? I cannot just put static data because it will change.

Thank.

+3
source share
2 answers

DoubleAnimationalso is not FrameworkElement, so the binding does not work either. See my answer to the previous question .

DataTemplate UserControl. , , To .

+4

, . Silverlight , .

, .

0

Source: https://habr.com/ru/post/1749138/


All Articles