旋转表面时窗口大小有时会改变

时间:2014-04-08 07:31:57

标签: c# wpf windows-applications screen-rotation

系统:Microsoft Surface,Windows 8.1(不是Win RT)

当我启动应用程序并激活键盘时,它在

中看起来像这样

肖像: enter image description here

景观: enter image description here

如您所见,键盘适合并且窗口大小最大化。当我继续多次旋转表面时,我有时会得到这个: enter image description here

窗口不再最大化。这只能通过再次手动最大化窗口来修复。任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

在此期间由我自己解决了这个问题。我向Microsoft.Win32.SystemEvents.DisplaySettingsChanging

添加了一个事件处理程序

在UI线程上做一个简短的Thread.Sleep。出现问题是因为键盘翻转反应比我自己的应用程序更快。我知道这是一种解决方法,但睡眠只有200毫秒,它就像魅力一样