Modal Dialog not showing on top of other windows

前端 未结 5 2018
无人及你
无人及你 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-06 00:14

    Had to do a bit of modification. I had to set the owner and activate the window. Check for the pop up window and activate the window as given below.

            var enumerator = Application.Current.Windows.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Window window = (Window)enumerator.Current;
                if (window != null && window.GetType() == typeof(PopUpWindow))
                {
                    window.Activate();
                }
            }
    

提交回复
热议问题