在Windows Universal App中使用StatusBar

时间:2015-09-22 19:22:48

标签: c# .net windows universal

我尝试使用以下代码从视图构造函数中检索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,这个班级应该存在。我甚至为Mobile设备系列添加了对Package.appxmanifest的依赖,但仍然没有。有什么想法吗?

1 个答案:

答案 0 :(得分:12)

您应该添加Microsoft Mobile Extension SDK

enter image description here