在 Windows 通用应用程序中使用 StatusBar

Using StatusBar in Windows Universal App

我正在尝试使用以下代码从视图构造函数中检索 StatusBar 对象: bool mobile = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract",1,0); if(mobile) { var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView(); }

使用 Visual Studio Community 2015,我收到以下错误: Error CS0731 The type forwarder for type 'Windows.UI.ViewManagement.StatusBar' in assembly 'Windows' causes a cycle Error CS1069 The type name 'StatusBar' could not be found in the namespace 'Windows.UI.ViewManagement'. This type has been forwarded to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.

根据 Microsoft,这个 class 应该存在。我什至为移动设备系列添加了对 Package.appxmanifest 的依赖,但仍然没有。有什么想法吗?

您应该添加 Microsoft Mobile Extension SDK