7 responses to “A Design Pattern for communication between UI and ViewModel”

  1. anvaka

    Thank you, Pavan! Very nice approach!

    I’m wondering how do you cover this code with unit tests? If you don’t how would you do that?

  2. Pradeep Mahdevu

    Pavan,
    I have implemented this in a different way and would like your inputs/comments on this.

    a) We follow MVVM.

    b) I created a class ViewModelUICommunicator which derives from FrameworkElement.

    c) When we want to run animations in view.xaml, I add an additional line of code

    As Viewmodel is derived from INPC, when source is changed RunAnimation is triggered.

    d) We can pass an additional storyboard in ViewModelUICommunicator to run animations directly without code behind like.

  3. Pradeep Mahdevu

    my code disappeared after I submitted :(

  4. VS

    Thanks Pavan! It is very nice & informative post.

    I know it could be too much to ask but was wondering if you can post a working sample here.

    VS

Leave a Reply