Visual Transitions

Let’s say you start with Button’s default template but morph it such that the two focus Rectangles fade in gradually when the control transitions to the Focused state. In this case, the harsh stopping of these animations when transitioning out of Focused probably won’t be satisfactory. However, because Unfocused and PointerFocused are left empty, the result is an instant jump to the default visual behavior. This could be solved by adding Storyboards with explicit animations to the default values, but one would have to be added for every property animated by any other state in the group in order to account for all possible transitions.

Fortunately, VisualStateGroup has a much better solution for this. It defines a Transitions ...

Get Universal Windows® Apps with XAML and C# Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.