Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: RequestionNavigation issue with prism 5

$
0
0
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.
    InitializeComponent()

    ' Add any initialization after the InitializeComponent() call.

    Me.DataContext = vm

End Sub
End Class

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
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 Class

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)
End Sub
Thank you in advance

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>