Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between MVVM Light and MVVM?

I've been programming my Windows 8 apps and Windows phone apps using MVVM. I'm about to be exposed to MVVM Light and I was just wondering what the difference between them are? I imagine MVVM light is a sandboxed version of MVVM that comes with WPF and WinRT/WP8 development.

Is there a simple answer? Why would one choose MVVM Light over MVVM?

like image 865
webdad3 Avatar asked Mar 20 '13 15:03

webdad3


4 Answers

There is no such thing as "MVVM full".

MVVM is a pattern on how to structure your UI and data and business logic.

MVVM light is a lightweight framework that supports you in implementing the pattern.

BTW: Hovering over the tags you used in your question will also answer this ;-)

like image 68
Daniel Hilgarth Avatar answered Sep 28 '22 05:09

Daniel Hilgarth


MVVM Light is intended as a toolkit (not a framework ;) that provides a suite of components that help you when writing applications according to the MVVM pattern. For example, MVVM Light has a few library classes that encapsulate code that is repetitive, snippets to speed up and facilitate the typing, project and item templates to speed up the creation of new applications and avoid losing time with the basic "wiring" of the app, etc.

like image 40
LBugnion Avatar answered Sep 28 '22 05:09

LBugnion


MVVM stands for ModelViewViewModel.

MVVM Light is a made up thing from "Laurent Bugnion" - GalaSoft

http://mvvmlight.codeplex.com/

MVVM is an enterprise application development pattern,a best practice. We can deep dive in by following page.

http://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx

If you would like to do whole business dedicated. Independent from User Interface elements such as silverlight TextBox, we need to apply MVVM pattern. By this way we reuse business part for other client platforms. Such as Windows Phone ..

If you know MVC you can resample Controller to ViewModel but this ViewModel does not contain any reference of objects in your view. And your VM may abstract your View.

I think an MVVM pattern applier for .NET should be aware of these technics; Commanding, CollectionViewSource for filtering sorting operations, DataContext, Binding, INotifyPropertyChanged

like image 39
Davut Gürbüz Avatar answered Sep 28 '22 06:09

Davut Gürbüz


One way I have been using both (distinctly) - MVVM is a design pattern which I have simply used to architect my code as per the patterns - so in essence MainWindow.xaml sits in View Folder, MainWindow_ViewModel.cs sits in VM folder and then there is Model.cs which sits in my Model folder. DataContext of the View is set with ViewModel class for wiring. Ofcourse MVVM is not just file organization but ensuring the code is written as per the pattern too (separation of logic and all the nice stuff which should be implemented as per the pattern). Doing this - doesnt necessarily need me to reference MVVM Light libraries to do the above.

I specifically use MVVM Light when I want to have communication between multiple ViewModels using the Messenger.Default.Send (to broadcast the value) Messenger.Default.Register (to get the value in a different VM)

Can share sample code if necessary. Hope that helps.

like image 28
Patrick Avatar answered Sep 28 '22 04:09

Patrick