Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
How to install MVVM Light Toolkit for Windows Phone
The MVVM Light Toolkit is a set of components to help people use the MVVM pattern (it may be used in all XAML/C# frameworks). This article shows how to install the nuget package for the MVVM Light Toolkit to a particular project.
There are other more general installation instructions in Installing the MVVM Light Toolkit (GalaSoft).
The packages are available in the Nuget Package Manager (for both targets) and can be installed to a project as follows:
- Open the project and select References, open the context menu with mouse (right click) and select Manage NuGet Packages …
- Install MVVM Light toolkit (for information about this package go here)
- Search for MVVM Light
- MVVM Light is then installed (as shown below)
The installation process adds a ViewModel folder to the project containing implementations of the "main" ViewModel and ViewModelLocator (and also adds some XML to the App.xaml to set the ViewModelLocator as a data source. These changes are discussed further in How to use MVVM Light Toolkit for Windows Phone.
In addition nuget makes a number of "standard" changes:
- The file packages.config file is added to the project, listing the installed packages:
<?xml version="1.0" encoding="utf-8"?>
<package id="MvvmLight" version="126.96.36.199" targetFramework="wp80" />
<package id="MvvmLightLibs" version="188.8.131.52" targetFramework="wp80" />
- The MVVM Light packages are installed to the project into a folder named packages, which you can find at the same level as the solution file: