C
C#11mo ago
AceOfAces

❔ Cannot plugin HanumanInstitute.MvvmDialogs with MS.Extensions.DependencyInjection

I'm having trouble plugging in the HanumanInstitute.MvvmDialogs with my project (that uses Microsoft.Extensions.DependencyInjection. Every time I try to create a ViewModel with the dialog service, I get the error on the screenshot. I have no idea how to initialize the ModelViewFactory. How can I do that? I am using Avalonia, but it should be reproducible with WPF. Here's the code for registering the dialog service:
var services = new ServiceCollection();
services.AddSingleton<IDialogService>(x => new DialogService(
new DialogManager(
viewLocator: new StrongViewLocator(),
dialogFactory: new DialogFactory().AddMessageBox().AddFluent(FluentMessageBoxType.ContentDialog)),
viewModelFactory: z => x.GetService(z)));
AppServices = services.BuildServiceProvider();
var services = new ServiceCollection();
services.AddSingleton<IDialogService>(x => new DialogService(
new DialogManager(
viewLocator: new StrongViewLocator(),
dialogFactory: new DialogFactory().AddMessageBox().AddFluent(FluentMessageBoxType.ContentDialog)),
viewModelFactory: z => x.GetService(z)));
AppServices = services.BuildServiceProvider();
1 Reply
Accord
Accord11mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.