How to set parameters to a storyboard in wpf?
-
24-09-2019 - |
Question
Let's say that I have this storyboard:
<Storyboard x:Key="OnMouseEnterStoryboard">
<DoubleAnimation BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" To="180" />
</Storyboard>
It's there a possibility that I can set the To
property from code. Something like
DoubleAnimation BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" To="{Binding angle}" />
And when I want to apply this animation to have a possibility to set it?
OTHER TIPS
Storyboards can have bindings, just like anything else - instead of trying to dig through and set this explicitly, bind it to something easier to get ahold of like the Window object or a ViewModel
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow