【问题标题】:What's the difference between CoreWindow.GetForCurrentThread().SizeChanged & Window.Current.SizeChanged eventCoreWindow.GetForCurrentThread().SizeChanged & Window.Current.SizeChanged 事件有什么区别
【发布时间】:2013-10-07 04:10:43
【问题描述】:

在 Windows Store 应用程序中,我们需要一个在设备方向改变时发生的事件。我找到了两个事件,有人知道它们之间有什么区别吗?

Windows.UI.Core.CoreWindow.GetForCurrentThread().SizeChanged

Windows.UI.Xaml.Window.Current.SizeChanged

【问题讨论】:

  • +1 好问题。我也想要一个解释的答案:-)
  • 也许是相同的事件。只是覆盖 :-) 这是常识的猜测

标签: c# events windows-runtime microsoft-metro windows-store-apps


【解决方案1】:

来自msdn

Window 对象只是显示来自 CoreWindow 的信息,它 依次引用系统创建的窗口。

CoreWindow 只是一个为Window 提供输入事件的对象,因此这两个事件引用了同一个系统事件。

【讨论】:

  • 那么应该使用哪一个以及为什么?
  • CoreWindow 不是低级的Window,例如它没有Content 属性,它只是为Window 提供输入事件的对象,并且有一些事件只能通过此对象获得,例如 CharacterReceivedAcceleratorKeyActivated 等。
猜你喜欢
  • 2011-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-27
  • 2014-03-12
  • 2011-02-11
  • 2013-03-04
相关资源
最近更新 更多