Independent versus Dependent Animations

Speaking of animating an element’s Width, it would be natural to try to repurpose the previous DoubleAnimation to animate the Button’s Width instead of its Opacity. After all, Width is a dependency property, and it’s of type double. So this should work, right? Well, yes, but not by default.

Animations that operate on an element’s Opacity, RenderTransform, or Projection can run on the GPU (in other words, are hardware accelerated) because the underlying visual surface being manipulated doesn’t need to change. So can animations on the Canvas.Left and Canvas.Top attached properties, which is effectively the same as animating a TranslateTransform. These are examples of independent animations.

Other animations, ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.