CmdPal: Add a viewmodel factory for pages (#40504)

_targets #40482_
ref #40113

A smaller refactor, to be sure.

This just moves the instantiation of PageViewModel objects out of the
ShellViewModel, and into its own class.

The idea being that other page types could be added, just by extending
that factory (or implementing your own), and then also handling those
new VMs in your ShellPage.xaml.cs equivalent.
This commit is contained in:
Mike Griese
2025-07-15 09:33:28 -05:00
committed by GitHub
parent 0783763dd0
commit 53bb471449
4 changed files with 46 additions and 17 deletions

View File

@@ -149,6 +149,7 @@ public partial class App : Application
// ViewModels
services.AddSingleton<ShellViewModel>();
services.AddSingleton<IPageViewModelFactoryService, PageViewModelFactory>();
return services.BuildServiceProvider();
}