how to close WPF page like window
I want to close a WPF page but Close()
for the page does not work. In a WPF window this.Close()
closes the window but in a WPF page, i开发者_StackOverflow中文版t doesn't work.
A page isn't a Window, and as such, it's not directly Closable. From the documentation for Page, a Page is intended to be "page of content that can be navigated to and hosted by" ...
You'll need to get a reference to the Page's host, and close it. If you're hosting this Page inside of a Window, you can close that Window.
replace the content of the container controller where you placed the page with some other or clear the container content
精彩评论