C# WPF child window (about window)
Asked Answered
S

2

5

I have an application on C#/WPF that I`m developing ... I have a btn named About which should open a new window that contains details about the application or whatever I will put in it.

When I click the btn, a new window (about) opens, when I click again, while the new window (about) is opened another one is opened, how can I prevent this from happening, I also want the application to be disabled when the About window is opened and to be enabled when the About window is closed, Like most of the applications when about is clicked.

Strophe answered 1/5, 2011 at 22:17 Comment(0)
H
5

You should use the ShowDialog Method: http://msdn.microsoft.com/en-us/library/system.windows.window.showdialog.aspx

Code Sample:

// Instantiate window
AboutWindow aboutWindow = new AboutWindow();

// Show window modally
// NOTE: Returns only when window is closed
Nullable<bool> dialogResult = aboutWindow.ShowDialog();
Happ answered 1/5, 2011 at 22:22 Comment(0)
E
1

Just use ShowDialog() method instead of Show()

AboutWindow aboutWindow = new AboutWindow();
aboutWindow.ShowDialog();
Enneagon answered 20/3, 2013 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.