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, it 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With