Window
Window
is a top-level ContentControl
.
You will not usually create instances of the Window
class directly; instead the Window
class is usually sub-classed for each type of window to be shown by an application. For information on how to create new window classes from templates see the quickstart.
Common Properties
Property | Description |
---|---|
Title | The window title |
Icon | The window icon |
SizeToContent | Describes the window's auto-sizing behavior |
WindowState | The minimized/maximized state of the window |
Source code
Show, hide and close a window
You can show a window using the Show
method:
var window = new MyWindow();
window.Show();
Windows can be closed using the Close
method. This has the same effect as when a user clicks the window's close button:
window.Close();
// A closed window cannot be shown.
window.Show();