简体   繁体   中英

How to Activate MainWindow in wpf application?

I have a WPF application with a MainWindow and a couple of Dialogs that appear over MainWindow. I want my main window to be activated and appear on top of all dialogs when its clicked. I have tried method Activate() but its not working,also tried Topmost which is also not working? Please suggest a solution.

I suppose you are using ShowDialog() to open the other dialogs. Try using Show() when opening new dialogs as that won't force you to close them before being able to access the MainWindow . Of course without a bit more information on your code it's impossible to know exactly what causes the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM