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?
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 ;-)
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With