Modal Dialog not showing on top of other windows

前端 未结 5 2021
无人及你
无人及你 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条回答
  •  猫巷女王i
    2020-12-05 23:48

    There isn't any code to base this off of, but it sounds like you have left off some properties on the Window you've created and expected ShowDialog to apply additional "dialog" semantics:

    Window window = new Window()
    {
        Title = "Modal Dialog",
        ShowInTaskbar = false,               // don't show the dialog on the taskbar
        Topmost = true,                      // ensure we're Always On Top
        ResizeMode = ResizeMode.NoResize,    // remove excess caption bar buttons
        Owner = Application.Current.MainWindow,
    };
    
    window.ShowDialog();
    

提交回复
热议问题