WPF – Layout To Layout Animations

January 15, 2009

tags: ,
no comments

A pretty common animation when dealing with WPF is the transition of an element from layout to layout.

Take the following scenario:
Let’s say I got a window with a form-like view.
The form has a rich textbox where the user can enter lots of content.

In this case, I would like to give the user the possibility to expand that textbox if he needs to edit it in a more convenient way.
So I go and add an expand button, when clicked I add the textbox as a child to a grid that is placed on the entire window’s size.
Of course, collapsing it would return it to its former panel.

That will work just fine, but hey!! this is WPF!
We want WoW!
We want animations!

We could of course create the animations we need and manually activate it altogether.

Fortunately, there’s the concept of “Layout To Layout” animation.

I found it in the WPF Feature Montage – Do download it to look at the code. (It’s located in Layout.xaml)

Once you understand the concept, these layout transitions are dead easy to perform.

If there’ll be a request for it, I will create a simple example illustrating the whole idea and implementation.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>