c# - 在 Windows Universal App 中使用 StatusBar

标签 c# .net windows universal

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

使用 Visual Studio Community 2015,我收到以下错误: 错误 CS0731 程序集“Windows”中类型“Windows.UI.ViewManagement.StatusBar”的类型转发器导致循环 错误 CS1069 在命名空间“Windows.UI.ViewManagement”中找不到类型名称“StatusBar”。此类型已转发到程序集“Windows,Version=255.255.255.255,Culture=neutral,PublicKeyToken=null,ContentType=WindowsRuntime”考虑添加对该程序集的引用。

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

最佳答案

您应该添加 Microsoft Mobile Extension SDK

enter image description here

关于c# - 在 Windows Universal App 中使用 StatusBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32725185/

相关文章:

c# - 从相对 URI 计算本地路径的正确方法

c# - 连接时字符串溢出

windows - 未设置变量?回声关闭

python - 在windows平台上的Xampp上运行Python代码

c# - 检测到达焦点范围末尾的 WPF 焦点

c# - .NET 的 32 位 block 密码

c# - 如何在 response.redirect 上使用 Target=_blank?

c# - 默认(结构) - 良好的风格?

.net - 使用路由 ID 值的 ASP.NET MVC 3 模型 ID

windows - 让 IExpress 安装以将文件复制到正确的位置