views:

586

answers:

2
+2  Q: 

Transitions in WPF

Hi everyone,

I really want to make rich applications which also include transitions, this way I can fit more on one window by fading out parts that I don't need and fading in parts I do.

But I don't know how to achieve this, I have read some tutorials on the net but they are quite hard to understand.

Maybe the great Stackoverflow community can provide an easy method which will allow me to achieve this?

I am using Expression Blend 3 and VS2010 RC for all my development, but will mainly be focusing on Blend for everything apart from advanced coding.

Thanks

+1  A: 

The easy way to do this would be to use a library like Transitionals. It provides a content control that you can just set your content, and when you change the content (manually or via data binding), it does the transition for you.

If you want to see how it works, I'd look at the source code - since it's open source, you have full access to see (at least this) one approach.

Reed Copsey
+2  A: 

If you're into Blend (I am, good choice!) I would recommend Visual State Manager over various transition presenters (in Transitionals, FluidKit, Bag-O-Tricks, etc). VSM is supported by Blend natively and it is quite easy to design transitions in there.

The difference is that transition presenters fit more nicely into MVVM style of programming - you're flipping the ViewModel, and the presenter automatically does the switching the UI, animating the process as a side effect. With VSM, transitions are more the primary goal than a side effect.

Sergey Aldoukhov
Huh? Your second paragraph argues very strongly for transition presenters and against VSM, but your first paragraph recommends VSM over transition presenters. What gives? Are you attempting to present contradictory arguments, or did I completely misunderstand what you are driving at?
Ray Burns
@ray-burns It is simple -if you're building a LOB app, use transition presenters, if you're building a game, use Blend and VSM. Of course not that black-and-white, just a guidance. MVVM is not everything, I use code-behind when appropriate and is not ashamed ;)
Sergey Aldoukhov
VSM looks quite difficult to understand how transitions are made, can you post some sort of tutorial to help understand this? I already have seen a Honeycomb tutorial on youtube, didn't help me.
Sandeep Bansal
It seems to me that most games would be easier to code using transition presenters than with VSM for the very reasons given in your second paragraph. Surely your game has a model too? Almost every game does. In any case I concur on recommending Blend for doing the design.
Ray Burns
@ray-burns A game ViewModel is (often) different from LOB ViewModel by showing the same data but in different states (which promotes VSM). LOB ViewModel often provides a different data for a same region, which fits TransitionPresenter. Of course, you can use both methods in the same application depending on a need.
Sergey Aldoukhov
I see what you are saying: Many common game view models embed VSM-like functionality, so if your view model fits the pattern of VSM, you may as well use VSM as part of your view model instead of coding it yourself.
Ray Burns