将项目从WP7升级到WP8后,动态磁贴无效

时间:2013-10-25 14:49:21

标签: c# .net windows-phone-7 windows-phone-8

将项目从WP7升级到WP8后,动态磁贴无效。有谁知道原因? 我已经完成了自定义磁贴,我将其保存为IsolatedStorage中的图片。 计划代理中的Tile代码:

.
.
.

ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
                   if (tile != null)
                   {
                       FlipTileData data = new FlipTileData()
                       {
                           SmallBackgroundImage = new Uri("isostore:" + mediumTile, UriKind.RelativeOrAbsolute),
                           BackgroundImage = new Uri("isostore:" + mediumTile, UriKind.RelativeOrAbsolute),
                           WideBackgroundImage = new Uri("isostore:" + wideTile, UriKind.RelativeOrAbsolute)
                       };

                   tile.Update(data);
               }
NotifyComplete();

1 个答案:

答案 0 :(得分:0)

要在IsolatedStorage中使用图像,您需要使用/ Shared / ShellContent路径。以下是修复代码:

ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
                   if (tile != null)
                   {
                       FlipTileData data = new FlipTileData()
                       {
                           SmallBackgroundImage = new Uri("isostore:/Shared/ShellContent/" + mediumTile, UriKind.RelativeOrAbsolute),
                           BackgroundImage = new Uri("isostore:/Shared/ShellContent/" + mediumTile, UriKind.RelativeOrAbsolute),
                           WideBackgroundImage = new Uri("isostore:/Shared/ShellContent/" + wideTile, UriKind.RelativeOrAbsolute)
                       };

                   tile.Update(data);
               }
NotifyComplete();