views:

131

answers:

1

This is ModuleInit.cs in Products module

public class ModuleInit : IModule
{
    private readonly IUnityContainer _container;
    private readonly IRegionManager _regionManager;

    public ModuleInit(IUnityContainer container, IRegionManager regionManager)
    {
        _container = container;
        _regionManager = regionManager;
    }

    #region IModule Members
    public void Initialize()
    {
        App app = (App)Application.Current;
        _regionManager.RegisterViewWithRegion(RegionNames.ModuleRegionProducts, () => _container.Resolve<Views.ProductsCycle>());
    }
    #endregion
}

Below is button event handler in ProductsCycle.cs to go to another view still within same module:

private void btnForward_Click(object sender, RoutedEventArgs e)
    {
        IRegion productsRegion = _regionManager.Regions["ModuleRegionProducts"];

        var productsListView = _container.Resolve<Views.ProductsList>();
        productsRegion.Add(productsListView, "ProductsList");

        productsRegion.Activate(productsListView);
    }

State: ProductsCycle page is successfully loaded on first load.

Problem: View doesn't changed from ProductCycle page to ProductsList page when btnForward is clicked.

I'm using Silverlight 4 and PRISM2. Please your advice, thank you.

A: 

change productsRegion.Activate(productsListView);

to productsRegion.Remove(this);

because my productListView is not inherited directly from UserControl.

Jeaffrey Gilbert