Thread.Join UI block in WPF

后端 未结 2 1662
傲寒
傲寒 2021-01-16 05:00

I created a custom MessageWindow in order to get rid of the old one and put my own style on it...

My problem is when I for example click a button to ope

2条回答
  •  被撕碎了的回忆
    2021-01-16 05:52

    If you want to prevent the user from interacting with the main window while a MessageWindow is visible, simply set the Owner of the MessageWindow to your application's main window. Then call ShowDialog() from the UI thread, and the behavior should be comparable to if you called MessageBox.Show().

    Do not use a separate thread or attempt to manually block the message pump.

提交回复
热议问题