I am trying to display a view into a region but I get this warning and I don't how to solve it. Can someone help me. Below are the codes:
I - Error Message :
An exception of type 'Microsoft.Practices.ServiceLocation.ActivationException' occurred in Microsoft.Practices.ServiceLocation.dll but was not handled in user code
Additional information: Activation error occurred while trying to get instance of type Object, key "EnrollView"
II - Code
A - EnrollView.vb:
Public Class EnrollView
Public Sub New(vm As EnrollViewModel)
' This call is required by the designer.
' Add any initialization after the InitializeComponent() call.
Me.DataContext = vm
B - ModuleInit.vb : This module registers a commandView as well as registers the EnrollView into the container to be called later into the program.
Public Class ModuleInit
Private ReadOnly _regionManager As IRegionManager
Private ReadOnly _container As IUnityContainer
Private ReadOnly _regionNames As RegionNames
Public Sub New(regionManager As IRegionManager, container As IUnityContainer)
Me._regionManager = regionManager
Me._container = container
Me._regionNames = New RegionNames()
Public Sub Initialize() Implements IModule.Initialize
Private Sub RegisterViewModule()
_regionManager.RegisterViewWithRegion(_regionNames.CommandRegion, Function() _container.Resolve(Of CommandView)())
_container.RegisterType(Of Object, EnrollView)("EnrollView")
C- CommandViewModel.vb: RequestNavigation is called when cmdenroll is called. The error happens during the RequestNavigation.
Private Sub cmdenroll()
Me. _regionManager.RequestNavigate(_regionNames.MainRegion, New Uri("EnrollView", UriKind.Relative), AddressOf NavigationCompleted)
Thank you in advance