locked
Animations and MVVM pattern RRS feed

  • Question

  • Supose you are using MVVM pattern, that means VIEW knows MODEL but MODEL does not know VIEW, right. All your code is suposed to be on MODEL. So, how do I start an animation on the VIEW on a determined change im MODEL?

     The Situation: User click on a Login control, This executes a Command in LoginViewModel that makes a request to a async WebService, if this WebService return an error I want to start an animation on the LoginControl, but how?

    Wednesday, May 6, 2009 9:31 PM

Answers

  • This is a good question.

    My solution is that the ViewModelBase expose an event ErrorOccured and the View attach this event in from the Model.

    When an error occur the ViewModelBase raise the event including the Exception details and the view handle the exception applying UI logic.

    While the event is exposed by an abstract ViewModelBase it is known by all the views and they have to handle it gracefully. Probably the ErrorOccuredEventArgs must contains an Handled boolean property because if none handle the exception the ViewModelBase has to rethrow it.

    HTH.

    bye

    Thursday, May 7, 2009 9:09 AM

All replies

  • I know that silverlight 3 has slow animations 

    I am not aware of anything in silverlight 2       

    Wednesday, May 6, 2009 11:07 PM
  • This is a good question.

    My solution is that the ViewModelBase expose an event ErrorOccured and the View attach this event in from the Model.

    When an error occur the ViewModelBase raise the event including the Exception details and the view handle the exception applying UI logic.

    While the event is exposed by an abstract ViewModelBase it is known by all the views and they have to handle it gracefully. Probably the ErrorOccuredEventArgs must contains an Handled boolean property because if none handle the exception the ViewModelBase has to rethrow it.

    HTH.

    bye

    Thursday, May 7, 2009 9:09 AM