views:

215

answers:

3

Hello all, I have an intriguing question. Let's say I want to play an animation or change the visual state etc of my view FROM THE VIEW MODEL. How can I do that? Its for building an MVVM application on windows phone 7.

A: 

What you're looking for are "DataTriggers". This is a pain in the ass for WP7 because you have to rely on buggy 3rd party libraries to get this to work (ex: http://expressionblend.codeplex.com/wikipage?title=Behaviors%20and%20Effects&referringTitle=Documentation abandonware?)

Silverlight 4 has this built in so there is light at the end of the tunnel but it's gonna take a while for WP7.

vidalsasoon
A: 

I'm also with the same questions, especially regarding the implementation part of the "menu" in windows phone 7.

The question is how to implement a command to wait a running animation.

Example: MyAnimation.Completed + = (s, e) => Message.Show("Test");

I really wanted to centralize my actions in ViewModel if you need any codebehavior.

Thanks

Erlon Cabral
A: 

You can also use the MVVM Light Toolkit's Messenger class: your view-model would send messages such as "play animation" and "change visual state" when appropriate, and your view's code-behind would register for these messages and react appropriately when they are sent.

Andréas Saudemont