Retaining the post-animation state

Back to How-to Discussions
The issue in this thread has been resolved.

Hi,

Again, please excuse the simple question!

When I do an animation in something such as <Activated> once the animation completes it then reverses back to the initial state. So how do I get the app to retain the post-animated stated rather than the initial state?

Thanks!

Iain

Hi!

To do that, you can for example use a <Timeline ux:Name="t1" > and in <Activated><Play Target="t1" /></Activated>

Alternatively, use a <StateGroup> and use the <Activated> trigger to change the state.

Also, depending on what your exact use-case is of course, there are often versions of triggers that stay on as long as some predicate is true or when your app is in a certain state.

In the case of Activated for example, you could instead use WhileActive which stays on as long as the page you're in is the currently active page.

Generally the triggers that start with While has this behavior.

Another way to approach this is to think about the "post-animation state" as the rest state of the element. Then you only need to describe the deviation from the rest state, and how the element "animates back" to it.

How exactly that's to be implemented depends on a particular use case though.

Post Stats
  • 5
    replies
  • 614
    views
  • 4
    users
Frequent Posters