diff --git a/Source/Windows10/Prism.DryIoc.Windows/DryIocContainerExtension.cs b/Source/Windows10/Prism.DryIoc.Windows/DryIocContainerExtension.cs index ea41eaf18a..89fad2fc0a 100644 --- a/Source/Windows10/Prism.DryIoc.Windows/DryIocContainerExtension.cs +++ b/Source/Windows10/Prism.DryIoc.Windows/DryIocContainerExtension.cs @@ -51,7 +51,7 @@ public object Resolve(Type type, string name) public object ResolveViewModelForView(object view, Type viewModelType) { - if (view is Page page) + if (view is Page page && page.Frame != null) { var service = NavigationService.Instances[page.Frame]; return Instance.Resolve(viewModelType, new[] { service }); diff --git a/Source/Windows10/Prism.Unity.Windows/UnityContainerExtension.cs b/Source/Windows10/Prism.Unity.Windows/UnityContainerExtension.cs index 645ace573e..0ca375f256 100644 --- a/Source/Windows10/Prism.Unity.Windows/UnityContainerExtension.cs +++ b/Source/Windows10/Prism.Unity.Windows/UnityContainerExtension.cs @@ -49,7 +49,7 @@ public object Resolve(Type type, string name) public object ResolveViewModelForView(object view, Type viewModelType) { - if (view is Page page) + if (view is Page page && page.Frame != null) { var service = NavigationService.Instances[page.Frame]; ResolverOverride[] overrides = null;