I`m learning the concepts of composite applications. I created prism application using unity container. One of my regions configed as content control - In this Region, I want show just single view.
I`m using view injection in the next way:
object lastView;
// View injection
IRegion region = regionManager.Regions["MainRegion"];
var ordersView = container.Resolve<OrdersView>();
lastView = ordersView;
region.Add(ordersView, "OrdersView");
region.Activate(ordersView);
This the views in this region are switched frequently.
Before Im switching view Im using region.remove(lastView)
and than adding the next view like the code above.
Im not sure that its a good implementation, I have a few questions: When I`m using region.remove method, Is the removed view being disposed? Because if not after long run I will have serious memory leaks. What is the best way implement single view in a region while avoiding memory leaks?
Thanks