If you go to
and download ChildViewClosing you will see my example.
My issue is closing a child view when parent view closes. I have a left region, a right region and a region within a view called inrightregion. I navigate to my EditView in the rightregion, which has the inrightregion, I then navigate to the DetailView in
the inrightregion. I deactivate the editview.
I then try to go to the EditView again but it still has the DetailView within? Why hasn't this been destroyed?
Jun 21, 2012 at 12:54 PM
Edited Jun 21, 2012 at 12:55 PM
I check your sample, and based on my understanding this behavior is caused because you are only deactivating the "EditView" from the region and not removing it.
As you can find in the following section (View and View Model Participation in Navigation) of the
Prism documentation, if you need to remove the view from the region when its deactivated, you could achieve this by implementing the
IRegionMemberLifetime interface, for example in your "EditViewModel", and returning
false in the KeepAlive property. This way, your view will be removed from your region when it is deactivated, and as you are using the
ClearChildViews attached property, your child view should be removed with it.
The other option you could try is just removing the view instead of deactivating it, for example your
"Close" method could look like this:
private void Close()
IRegion region = _regionManager.Regions[RegionNames.RightRegion];
I hope you find this handy,