Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVVM, Animations and Commanding - Best way to kick off animations?

Users love animations. See the iphone for a good example :) Everything a user does in the iphone kicks off an animation.

Enter MVVM and Commanding (I'm thinking about Silverlight 2 specifically). A user action triggers an event via Commanding, and we're sitting in the ViewModel thinking about how to trigger a nice animation for the user...

There are some possibilities, but I don't find any of them particularly tasteful.

  • A bit of MVP. Have the View implement an interface and then have the VM call a method on the view to start an animation.
  • In Silverlight 3 Actions/Behaviors might be a kind of answer, but I'm trying to figure out the best approach for SL 2.
  • Do hokey animations from the VM where you update (via a timer) binding properties to make things happen... Pretty awkward.

Has anyone had good success with an approach?

like image 375
Erik Mork Avatar asked Jun 17 '09 17:06

Erik Mork


1 Answers

Typically I use events to fire the animations from the viewmodel in Silverlight 2

like image 197
zachary Avatar answered Oct 25 '22 09:10

zachary