Recalling PUG Monthly Meet - MVVM from Scratch using Silverlight


MVVM from Scratch using Silverlight - PUG Monthly Meet - July 2011

On last Saturday (i.e. 9th July 2011) I delivered one hour session on "MVVM from Scratch using Silverlight" in Pune User Group's (PUG) Monthly meet. The session was full of demo and very little with slides.

 

In this post I will just recap the session for you to know what are the things I discussed there. I will also share the slides here, if you want to go through it offline.

 

As many people were there who are working in Silverlight/WPF and MVVM, hence it was quite interesting for them. The session started with the very basic of MVVM. I discussed what is MVVM and why should a developer opt for MVVM pattern while working on Silverlight, WPF and Windows Phone 7 application.

 

I started with my favourite example to demonstrate the MVVM pattern using a Car. How can we compare a car with MVVM pattern to remember what is Model, View and ViewModel. Earlier I blogged about it with the full explanation. If you want to read that, you can find it here: "Generally How I describe MVVM in the Presentations or to my Friends".

 

Demonstrating MVVM with the help of a Car - PUG Monthly Meet - July 2011

 

There I described about various ways to replace the general event implementations in MVVM pattern to make it almost zero codes in the code behind file. I talked about general event implementation, talked about Notification using the INotifyPropertyChange, Command, Event Aggregator and my favourite Behavior.

 

Later jumped into the code to create an MVVM application where I described more about the structure and implementation of MVVM pattern. I gave more hands-on in Behaviors. Demonstrated how to inbuilt behaviors can help us to call the ViewModel's method directly from the XAML without using the code behind, demonstrated more on changing any UIElement's property with behavior from the XAML. Later jumped into the code to create a behavior from scratch. There was a good interaction with the audience while demonstrating the behavior and people liked it very much.

 

At the end, shared some guidelines that should be at least follow while using the MVVM pattern. If those points you remember, your application will be more cleaner and easier to maintain.

 

View and Download the PPT

 

 

Download PPT - MVVM from Scratch using Silverlight

 

Thanks to everyone who attended the session. Also my sincere thanks to the Pune User Group for giving me chance to speak on that topic. Follow my blog, if you are not already. I am also available on Facebook and Twitter. You can contact me there too.

 

Reference: Recalling PUG Monthly Meet - MVVM from Scratch using Silverlight


If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter , Facebook , Google+ and LinkedIn . I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

14 comments

  1. Hi,

    This is vinayak, i have attended the this session. It was very good and usefull.

    can you please share the demo also

    here is my email address : vinayak.salunke@hotmail.com

    ReplyDelete
  2. Hello Kunal,
    Can you share Demo please.

    Thanks for nice session.

    ReplyDelete
  3. Yes, I will upload the demo code tonight. Thanks for attending the session.

    ReplyDelete
  4. Everyone, updated the post with the link of the source code in case you want to download it for reference. Let me know, if you need further help on Behaviors.

    ReplyDelete
  5. Hello Kunal, It's great demo but.
    There are missing DLLs,
    1. System.Windows.Interactivity;
    2. Microsoft.Expression.Interactions

    can you put in a demo or give a link so we can download trusted DLLs.

    Thanks

    ReplyDelete
  6. You can get them if you already have Expression Blend installed in your PC. BTW, uploaded the binaries here: Download Dependent Interaction Binaries

    Cheers...
    ~Kunal

    ReplyDelete
  7. Thanks for Binaries as well.

    ReplyDelete
  8. good article.
    BTW,
    why you didn't use following class in demo app though you have provided it in.

    public class EmployeeService
    {
    public static ObservableCollection GetDetails()
    {
    return new ObservableCollection
    {
    new Employee {Firstname = "Kunal", Lastname = "Chowdhury"},
    new Employee {Firstname = "Vikram", Lastname = "Pendse"},
    new Employee {Firstname = "Mayur", Lastname = "Tendulkar"},
    new Employee {Firstname = "Mahesh", Lastname = "Mitkari"},
    new Employee {Firstname = "Abhishek", Lastname = "Sur"},
    new Employee {Firstname = "Amol", Lastname = "Bodake"},
    new Employee {Firstname = "Ramesh", Lastname = "Sen"},
    };
    }
    }

    ReplyDelete
  9. Hi,

    The class was used while demonstrating MVVM and later the call was removed while demonstrating some other points asked by attendees. It's the whole solution that I created during the event.

    Let me know, if you need further assistance.

    ReplyDelete
  10. No video? I really love learning through videos, I can stop them and watch and follow along. Could you please start doing more videos? Do you currently have any videos? Thanks, Victor

    ReplyDelete
  11. Hi Victor,

    No, we don't have any recordings of this event.

    ReplyDelete
  12. I am new to MVVM, I have checked your demo, it's too good. I have one question that why the below given code is written two times, one in "Employee.cs" and "MainViewModel.cs" ? Normally we declare properties in Model i.e here in "Employee.cs" then also do we need to declare properties in ViewModel i.e. here in "MainViewModel.cs" ?
    ======================
    private string m_firstname;

    public string Firstname
    {
    get { return m_firstname; }
    set { m_firstname = value; OnPropertyChanged("Firstname"); }
    }

    ReplyDelete
  13. Hi Farhan,

    This is a demo solution. To showcase how to bind a simple property present in the ViewModel, I used the "Firstname" from MainViewModel class and to showcase a complex property present in the ViewModel, I used the "Employee" class which has the simple property "Firstname" in the Model construction.

    There is no relation between Firstname present in MainViewModel and Employee model.

    Let me know, if you still have any doubts.

    Regards,
    Kunal

    ReplyDelete


 
© 2008-2016 Kunal-Chowdhury.com - Microsoft Technology Blog for developers and consumers | Designed by Kunal Chowdhury
Back to top