diff --git a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs index 2b1694068..0adaaa1de 100644 --- a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs +++ b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs @@ -35,7 +35,10 @@ public static class RegionNavigationRegistrationExtensions where TViewModel : class => containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), typeof(TViewModel), name); - public static IContainerRegistry RegisterForNavigationWithViewModel(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name) + public static IContainerRegistry RegisterForRegionNavigation(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name = null) + => containerRegistry.RegisterForNavigationWithViewModel(viewType, viewModelType, name); + + private static IContainerRegistry RegisterForNavigationWithViewModel(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name) { if (string.IsNullOrWhiteSpace(name)) name = viewType.Name; @@ -77,6 +80,9 @@ public static IContainerRegistry RegisterForNavigationWithViewModel(this IContai where TViewModel : class => services.RegisterForNavigationWithViewModel(typeof(TView), typeof(TViewModel), name); + public static IServiceCollection RegisterForRegionNavigation(this IServiceCollection services, Type viewType, Type viewModelType, string name = null) + => services.RegisterForNavigationWithViewModel(viewType, viewModelType, name); + private static IServiceCollection RegisterForNavigationWithViewModel(this IServiceCollection services, Type viewType, Type viewModelType, string name) { if (string.IsNullOrWhiteSpace(name))