arti
arti

Reputation: 657

Close another window in WPF

I'm building a multi-window app. The problem I've got, I can't close "Window1" or "Window2" from button in "MainWindow". All windows are in the same app. Is there a way to kill another window?

Upvotes: 0

Views: 1106

Answers (1)

Domysee
Domysee

Reputation: 12846

Sure there is. If you have a reference to that Window, just call the Close() method.

Window window1 = new Window1();
window1.Show();
...
window1.Close();

Upvotes: 4

Related Questions