How to remove a view from region that was added using RequestNavigate?
I am using Prism for navigation in my WPF application. I register all my
views as follows.
_container.RegisterType<object, MyView>("MyView");
I display this view as follows.
myRegionManager.RequestNavigate(
"MyRegionName",
"MyView")
Elsewhere in the application, I need to remove this view in an event
handler. The following code does returns an ArgumentNullException.
myRegionManager.Regions["MyRegionName"].Remove(
myRegionManager.Regions["MyRegionName"].GetView("MyView")
);
I know that if I were to use myRegionManager.Add(MyView, "MyView") method,
the above code would work, but RequestNavigate does not seem to handle the
view name in the same way. Is there any way to remove a view that was
added to a region with RequestNavigate?
No comments:
Post a Comment