In general, when adding a view to a region, we need to determine if the view already exists in region, but if we are not at the time of the Region.add method call, we always return null in GetView because of an error in Add
Error review
view = ServiceLocator.Current.GetInstance (typeof (Applicationview), "Applicationview");
This. Regionmanager.regions[regionnames.maincontentregion]. ADD (view);
In this way we
var view=this. Regionmanager.regions[regionnames.maincontentregion]. GetView ("Applicationview");
The returned result will always be null, and the correct calling method is shown below
var view=this. Regionmanager.regions[regionnames.maincontentregion]. GetView ("Applicationview"); if (view = = null) {view = ServiceLocator.Current.GetInstance (typeof (Applicationview), "Applicat Ionview "); This. Regionmanager.regions[regionnames.maincontentregion]. ADD (View, "Applicationview"); } this. Regionmanager.regions[regionnames.maincontentregion]. Activate (view);
Solving the getview of region in Prism does not work.