何时以及为什么访问CoreWindow.ActivationMode会抛出InvalidCastException?

时间:2018-05-06 21:55:37

标签: c# uwp windows-10 windows-10-mobile

我的应用必须对ListView的ScrollViewer的ViewChanged事件作出反应,在该事件处理程序中我想知道当前窗口是否具有焦点:

CoreWindow window = Window.Current.CoreWindow;
CoreWindowActivationMode mode = window.ActivationMode;

不幸的是,用户访问window.ActivationMode的w10m设备有时(显然取决于ScrollViewer的内容)会抛出System.InvalidCastException。 ActivationMode属性的文档没有提到任何异常,并且异常消息也没有帮助:

InvalidCast_WinRT, Windows.UI.Core.CoreWindow, MissingMetadataType. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485

如果这是一个windows / uwp错误,我应该在哪里报告?

0 个答案:

没有答案