I like this toolkit so much and will change mvvmlight to Microsoft.Toolkit.Mvvm,I have learned a lot about the features of this package from your sample code. By the way, I like use ViewModelLocator in MVVM Pattern,and define static object for the current instance in ViewModel is not a good way in some way, so here are my sample code:
public class ViewModelLocator
{
public ViewModelLocator()
{
Ioc.Default.ConfigureServices(services =>
{
services.AddSingleton<ILogger, DebugLogger>();
services.AddSingleton<MainViewModel>();
});
}
public static MainViewModel Main => Ioc.Default.GetService<MainViewModel>();
}
I like this toolkit so much and will change
mvvmlight
toMicrosoft.Toolkit.Mvvm
,I have learned a lot about the features of this package from your sample code. By the way, I like useViewModelLocator
inMVVM Pattern
,and define static object for the current instance in ViewModel is not a good way in some way, so here are my sample code: