On Demand Module Load

Topics: Prism v2 - WPF 3.5
Feb 25, 2009 at 5:23 PM
Hi all,
I'm trying to load a view in a region depending on an item selection in a different module and in a different region.

Following the QS I have changed the IModule instantiation, so the IModule class is as follow

private readonly IRegionManager regionManager;
private readonly Module_AView AView;
public

MainModuleA(IRegionManager regionManager, Module_AView AView)
{
        this.regionManager = regionManager;
}

 

 

public void Initialize()
{
        this.regionManager.Regions["Region_A"].Add(this.AView);
}

AView code behind
...
...
moduleManager.LoadModule(
"Module_B");
...
...

After this change, the RegionA is no longer displayed even if I can see the correct Initialize of the AView.

If I revert the code to the previous definition (without the second constructor parameter) AView appear again. But I cannot load the new module ...
Do I've lost / forgot something?
Any help is appreciated

TIA, Ax

 

Feb 25, 2009 at 9:59 PM
Ok ... I don't have initializated the local variable _AView ... my fault.

private readonly IRegionManager _regionManager;
private readonly AView _AView;

public
AModule(IRegionManager regionManager, AView AView)

 

{

    this._regionManager = regionManager;
    this._AView = AView; // <---------------
}

 

 

public void Initialize()
{
    this._regionManager.Regions["AView"].Add(this._AView);
}

 

 

 

Feb 25, 2009 at 10:59 PM
I'm here again.
At this point I can't see the second view in the region.
The scenario is a mainRegion with a Splash form loaded as the shell starts, then, when the user make it's selection I load a new Module / View in the mainRegion as previously mentioned.
I can see the Module / View initialization but the region don't change the displayed view.

Ax