Modal Dialog not showing on top of other windows

前端 未结 5 1997
无人及你
无人及你 2020-12-05 23:43

I am using Window.ShowDialog() to open a modal window in my WPF (MVVM) application, but it lets me navigate to other windows using the Windows taskbar (Windows

5条回答
  •  有刺的猬
    2020-12-05 23:54

    Just set the owner property of the Window to the calling window. Then the activation of the WPF application in taskbar not just activates the MainWindow but also the modal child window and brings it to the front.

    ChildWindow C = new ChildWindow();
    C.Owner = this;
    C.ShowDialog();
    

提交回复
热议问题