The Contains method verifies is the view instance passed as a parameter is inside the region. The problem is that you are creating a new instance of the view (through the presenter) every
time that command is executed.
To solve this, you can add a named view using the overload in the
Add method of the region. Then you can check if that named view is in the region by using the
GetView method without need of creating a new instance every time. Check the following sample code:
private void ActivateView()
IRegion mainRegion = _regionManager.Regions["MainRegion"];
object view = mainRegion.GetView("MyView");
(view == null)
IChampionshipsPresenter presenter = _container.Resolve<IChampionshipsPresenter>();
view = presenter.View;
You can find more samples in the
UI composition Quickstart, where named views are used to show the information of every employee.
Please let me know if this helps.