0

我有一个应用程序接受用户输入,对其进行验证,然后显示错误屏幕或继续到下一页。

当抛出错误时,它调用静态方法并传递错误消息的资源键。这个静态方法会启动一个最顶层的新窗口。

问题是这个错误窗口在它自己的线程中运行。在用户输入的主窗口中,我将焦点称为textbox. 因此,当用户再次开始输入时,它实际上是在文本框中输入的。但是,当我将焦点放在文本框上时,它也会将错误窗口放在主窗口后面。

我怎样才能在文本框上而不从错误窗口中Focus窃取?topmost

4

1 回答 1

0

I believe that this is the normal focus behaviour. If you were to manually click in the TextBox to focus it, that window would become the focused window. There are a few things that you could try to get around this.

Have you tried setting ErrorWindow.TopMost = true and MainWindow.TopMost = false?

You could try displaying the errors in the first window instead... the users would probably prefer this too.

于 2013-08-21T13:55:45.717 回答