Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to close WPF page like window

Tags:

wpf

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.

like image 221
mo_al Avatar asked Jun 06 '11 17:06

mo_al


1 Answers

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.

like image 115
Reed Copsey Avatar answered Oct 31 '22 18:10

Reed Copsey