【问题标题】:Secondary Tile has no image次要瓷砖没有图像
【发布时间】:2013-12-11 06:28:45
【问题描述】:

我有一个 Windows 8 应用程序,它使用以下代码生成辅助磁贴:-

            var itemId = globalId;
            var itemTitle = Constants.getName(itemId);
            var itemImg = Constants.getImage(itemId);
            var itemImage = new Uri(itemImg);

            var tile = new SecondaryTile(
                    itemId,
                    "App Name: " + itemTitle,
                    "App Name: " + itemTitle,
                    itemId,
                    TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo,
                    itemImage,
                    itemImage
                );

            tile.VisualElements.ForegroundText = ForegroundText.Light;

            bool pinned = await tile.RequestCreateForSelectionAsync(GetElementRectangle(sender as FrameworkElement), Placement.Below);

代码正确执行,itemImage 给出如下内容: {ms-appx:///Images/img1.png}。但是,虽然正确生成了 tile 的大小、tile 的名称和参数,但生成的 tile 没有图像并显示默认灰色。

这适用于我的其他应用之一,所以我无法弄清楚为什么它在这里不起作用。图像甚至可以在 pin 之外正确加载以启动对话框,因为它在应用程序的其他地方使用。

它肯定包含在项目中,并且构建操作设置为内容。

有什么想法吗?

【问题讨论】:

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


    【解决方案1】:

    你不能简单地使用 Uri,只需替换 "var itemImage = new Uri(itemImg);" with "var itemImage=new Windows.Foundation.Uri("ms-appx:///把图片的路径放在这里。");"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-04
      • 1970-01-01
      • 1970-01-01
      • 2011-07-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多