开发者

how to close WPF page like window

开发者 https://www.devze.com 2023-03-11 06:23 出处:网络
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, a

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

0

精彩评论

暂无评论...
验证码 换一张
取 消