Based on my understanding, when registering a view in a region, Prism
will inject the view a soon as the region becomes available. Therefore, when using this approach you will not have control of when the views will be added to the region.
If you want to control when a view is added or removed from a region (for example, when a command is executed, etc) you could try other
UI composition approaches provided by Prism, like
view injection or navigation. You can find information about the differences of
view discovery and view injection in the following section of the
For example, if you want to use navigation, you need to
register the views in the container (instead of the region) and then perform a
navigation request when you navigate to the view. For example, you can register the views like this in the
Initialize method (assuming you are using Unity
as the container):
//We register the view types in the container for navigation.
//You can still register one of those views in the region, so that it's added on when the region is available.
var codingMainTreeView = _container.Resolve<Views.CodingMainTreeView>();
_regionManager.RegisterViewWithRegion(RegionNames.MainRagionName, () => codingMainTreeView);
Then, when you want to navigate to a view (for example to a VouchersMainView) when a command is executed, you can perform a navigation request:
You can find more information regarding UI composition and navigation in the following chapters of the
I hope you find this useful,