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
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
C- CommandViewModel.vb: RequestNavigation is called when cmdenroll is called. The error happens during the RequestNavigation.
Private Sub cmdenroll()
Me._eventaggregator.GetEvent(Of ButtonSelectedEvent).Publish("Enroll")
Me. _regionManager.RequestNavigate(_regionNames.MainRegion, New Uri("EnrollView", UriKind.Relative), AddressOf NavigationCompleted)
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.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.DataContext = vm
End Sub
End ClassB - 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
Implements IModule
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()
End Sub
Public Sub Initialize() Implements IModule.Initialize
RegisterViewModule()
End Sub
Private Sub RegisterViewModule()
_regionManager.RegisterViewWithRegion(_regionNames.CommandRegion, Function() _container.Resolve(Of CommandView)())
_container.RegisterType(Of Object, EnrollView)("EnrollView")
End Sub
End ClassC- CommandViewModel.vb: RequestNavigation is called when cmdenroll is called. The error happens during the RequestNavigation.
Private Sub cmdenroll()
Me._eventaggregator.GetEvent(Of ButtonSelectedEvent).Publish("Enroll")
Me. _regionManager.RequestNavigate(_regionNames.MainRegion, New Uri("EnrollView", UriKind.Relative), AddressOf NavigationCompleted)
End Sub
Thank you in advance