开发者

Waiting for WPF window in non-WPF project

Why is it that if I call a WPF form from another project type (e.g. a console application or XNA game), the main application doesn't wait for the form to close before ending (and subsequently closing the form)?

I know with a dialog box I can make the main class wait for a reponse, how can开发者_C百科 I make it do that with my form?


You can open the window in modal mode using the ShowDialog method - the ShowDialog method only returns after the window was closed. Otherwise you can either wait until the Closed event is fired or wait until Application.Windows collection is empty (meaning the application has no WPF windows left).

For more information about window closing in WPF, refer to this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜