MVVM Light: Cannot create an instance of "ViewModelLocator" on Windows 8
When you create a new Windows 8 Metro style application and install MVVM Light using NuGet (full install), it will create a ViewModelLocator class in the ViewModel folder.
After you've modified your MainPage's datacontext to the new MainViewModel using this line:
DataContext=", Path=Main}"
Loading your view in the designer returns this error:
Cannot create an instance of "ViewModelLocator"
It looks like the included file for the ViewModelLocator in the NuGet package contains an error.
Quick fix:
Make sure your ViewModelLocator constructor is static:
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
static ViewModelLocator()
{
}