How to start using MvvmLight on a .net core 3 WPF app?
What exactly do you mean by 'it isn't complete in my case'? Do you get any errors when building the project?
I'm using MvvmLight in my projects too. As an example:
In App.xaml
<ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True"
xmlns:vm="clr-namespace:$AssemblyName$.ViewModel" />
</ResourceDictionary>
In MainWindow.xaml
DataContext="{Binding Main, Source={StaticResource Locator}}"
In ViewModelLocator.cs
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
SimpleIoc.Default.Register<MainViewModel>();
}
public MainViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance<MainViewModel>();
}
}
This should do the trick... But as mentioned above, it would be interesting to know, if you get any errors.
A lot of things have happened in the 1.5 years since you ask this question. Microsoft is now supporting a replacement for MVVMLight. Have you heard of Microsoft.Toolkit.MVVM? Please see: https://github.com/windows-toolkit/MVVM-Samples It is supposed to be more compatible with .NET Core. Opps, I forgot it is now just .NET (for Rev5 and over)