Tuesday, May 24, 2011

Simple WPF Page Transitions

Introduction / Background 
I have a little side project that I am working on which has multiple pages of information that need to be displayed, and I wanted a slicker way to transition between pages (UserControls) than just popping them into and out of existence (bad for the eyes).

My desire was to have better looking transitions, and this lead me to develop a very simple control library with several animations built in for more elegant page switches. 
The following page transition types are currently included in this version of the control:

Fade
Slide 
SlideAndFade
Grow
GrowAndFade
Flip 
FlipAndFade
Spin

The control itself is very simple... it consists of a UserControl (PageTransition), which contains all of the translation logic.  Inside this control, there are several animations in the UserControl.Resources tag, defining all of the available animations.  There is also an enum (PageTransitionType) which is mapped as a DependencyProperty that defines which animations are available to the users of the control.

Read more: Codeproject