Reputation: 833
Referring the StockTraderRI, I created a popup region in my shell
infBehaviors:RegionPopupBehaviors.CreatePopupRegionWithName="{x:Static inf:RegionNames.SecondaryRegion}"
In the module I am trying to load the view to the popup
_regionManager.RequestNavigate(RegionNames.SecondaryRegion, new Uri("/OrderDetailsView", UriKind.Relative));
OrderDetailsView is a view within OrderDetailsModule. At this point I am getting the below error
Activation error occurred while trying to get instance of type Object, key "OrderDetailsView"
Stack trace looks like below
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 53
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService](String key) in c:\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 103
at Prism.Regions.RegionNavigationContentLoader.CreateNewRegionItem(String candidateTargetContract)
Any ideas what i might be doing wrong?
Upvotes: 1
Views: 925
Reputation:
You must register your objects for navigation. If you are using Prism 6 you must use Container.RegisterTypeForNavigation<OrderDetailsView>();
If using v5 or less you must use container.RegisterType(typeof(object), typeof(OrderDetailsView), "OrderDetailsView");
EDIT: If using MEF, you must provide the view name in the Export Attribute:
[Export("OrderDetailsView")]
public class OrderDetailsView : UserControl
{ ... }
Upvotes: 1