导航以及如何在区域中注册视图?

navigation and how to register the view with the region?

我有两个视图,我想在单击按钮时在它们之间导航,它们在模块初始化时注册到一个区域,如下所示:

public class ModuleTaxCalc : IModule //PRISM MODULE POWER
{
    IUnityContainer container;
    IRegionManager regionManager;


    public ModuleTaxCalc(IUnityContainer container, IRegionManager regionManager)
    {
        this.container = container;
        this.regionManager = regionManager;

    }

    public void Initialize()
    {

        container.RegisterType<ICustomer, Customer>();

        //container.RegisterType<object, ViewA>("ViewA");
        //container.RegisterType<object, ViewB>("ViewB");
        regionManager.RegisterViewWithRegion("TaxCalculatorRegion", typeof(ViewA));
        regionManager.RegisterViewWithRegion("TaxCalculatorRegion", typeof(ViewB));

    }


}

我的问题是 'ViewA' 在应用程序启动时自动可见/

如果我这样做:

 public void Initialize()
        {

            container.RegisterType<object, ViewA>("ViewA");
            container.RegisterType<object, ViewB>("ViewB");


        }

那么这两个视图都是不可见的,只有在单击按钮时才可见,但我想在这种情况下它们没有注册到该区域。

对于导航,您想注册导航视图,然后导航到它们。

// register the view
container.RegisterTypeForNavigation<ViewA>();

// and some time later, show it in the region
regionManager.RequestNavigate( "TaxCalculatorRegion", "ViewA" );

如果您改为在区域中注册视图,它将自动显示在该区域中(视图发现)。 Prism documentation...

中提供了更多详细信息