Prism: ImportingConstructor

Mar 2, 2012 at 1:02 AM

Hi,

I am learning Prism...

I want to use ImportingConstructor but it didnt work. :-(

My Class:

<Export()> _
    <PartCreationPolicy(CreationPolicy.NonShared)> _
    Public Class PrismTypes

        Public Property myServiceLocator As IServiceLocator
        Public Property myRegionManager As IRegionManager
        Public Property myEventAggregator As IEventAggregator

        <ImportingConstructor()> _
        Public Sub New(ByVal eventAggregator As IEventAggregator, ByVal regionManager As IRegionManager, ByVal serviceLocator As IServiceLocator)

            myEventAggregator = eventAggregator
            myRegionManager = regionManager
            myServiceLocator = serviceLocator

        End Sub
    End Class

Now

Dim myPrism As New PrismTypes

 

produces an error that I must declare the parameters for the constructor.

Can somebody help?