locked
Use of MVVM RRS feed

  • Question

  • Hello Everyone,

            In windows store apps, why mvvm pattern is use?

    Simple architecture is not suitable for develop windows store apps?

    Tuesday, June 4, 2013 9:13 AM

Answers

  • View

    • Defines structure and appearance
    • Includes user control or Data Template
    • Events are implemented in the Logic i.e. Code Behind, in most cases using Behaviors and things like EventToCommand you can replace them with Commands in ViewModel

    ViewModel

    • Connector between View and Model
    • No strong or weak (via Interface) reference of View
    • Exposes the Model properties used in View
    • Implements INotifyPropertyChange
    • Uses Observable Collection<T> for collection of Data.
    • The View Model exposes ICommand properties for UI controls with Command properties.

    Model

    • Any Data Model – WCF, Service, Domain-class proxy, etc.
    • No reference to ViewModel
    • Pure Data – no knowledge of UI

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you.

    Happy Coding!!!



    • Edited by Vishal Kaushik Wednesday, June 5, 2013 7:02 AM
    • Proposed as answer by Berndt Hambo Wednesday, June 5, 2013 7:10 AM
    • Marked as answer by Khant Nipun Wednesday, June 5, 2013 8:32 AM
    Wednesday, June 5, 2013 6:57 AM

All replies

  • If you what to know why MVVM then

        • it helps separate UI from Application logic
        • UI is considered job of UX (User Experience) Designers and Application Logic is considered job of Developers do helps in isolating their work
        • increases testability of Application logic and that too via automated tests
        • XAML is very powerful in Data Binding and related stuff that is built in core of it and is basis of MVVM

        In your other question I have already shared some links for MVVM

      • Practical MVVM For Windows Phone
    • Advance MVVM in Windows 8

    If you have seen those then you should be able to understand in detail.

    It is not a mandatory thing to use MVVM design pattern and applications like Games are not best fit for MVVM as your Application Logic needs to closely know UI and has to operate in tightly coupled manner. Still you should take advantages of MVVM as much as possible like DataBinding.


    -- Vishal Kaushik --


    Tuesday, June 4, 2013 9:22 AM
  • Hello Vishal Kaushik,

        As per my understand the model is that contains for data access layer , View model is for using data binding purpose & view for only GUI, but what about command & event like button's click event checkbox's selected event... etc. So any sample related any windows store app using mvvm, Plz send me or link for better understand. Thanks in advance

    Wednesday, June 5, 2013 5:42 AM
  • View

    • Defines structure and appearance
    • Includes user control or Data Template
    • Events are implemented in the Logic i.e. Code Behind, in most cases using Behaviors and things like EventToCommand you can replace them with Commands in ViewModel

    ViewModel

    • Connector between View and Model
    • No strong or weak (via Interface) reference of View
    • Exposes the Model properties used in View
    • Implements INotifyPropertyChange
    • Uses Observable Collection<T> for collection of Data.
    • The View Model exposes ICommand properties for UI controls with Command properties.

    Model

    • Any Data Model – WCF, Service, Domain-class proxy, etc.
    • No reference to ViewModel
    • Pure Data – no knowledge of UI

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you.

    Happy Coding!!!



    • Edited by Vishal Kaushik Wednesday, June 5, 2013 7:02 AM
    • Proposed as answer by Berndt Hambo Wednesday, June 5, 2013 7:10 AM
    • Marked as answer by Khant Nipun Wednesday, June 5, 2013 8:32 AM
    Wednesday, June 5, 2013 6:57 AM