Windows Phone中不同的大型瓷砖和中型瓷砖

时间:2013-07-09 11:33:15

标签: c# windows-phone-8

我有一个支持Live Tiles的Windows Phone 8(默认的中小型)。我使用相当标准的代码更新Live Tile

var tile = ShellTile.ActiveTiles.First();
if (tile == null) return;

var data = new StandardTileData {Title = "some title"};
data.BackgroundImage = new Uri("/Background.png", UriKind.Relative);
data.Count = count;
tile.Update(data);

我想添加对大型瓷砖的支持,但我希望与众不同。我不想使用计数,我想为图像渲染一些自定义文本:

var data = new StandardTileData {Title = "some title"};
data.BackgroundImage = new Uri("path to a custom rendered image", UriKind.Relative);
data.Count = 0;

我的问题是,如何确定我的动态磁贴是中(小)还是大都做出适当的更新?或者如何为中(小)和大瓷砖设置瓷砖更新完全不同?

1 个答案:

答案 0 :(得分:3)

StandardTileData是用于切片数据的WP7特定格式。这是WP8的等价物 FlipTileData包含不同切片大小的单独属性:

FlipTileData TileData = new FlipTileData()
{
   Title = "[title]",
   BackTitle = "[back of Tile title]",
   BackContent = "[back of medium Tile size content]",
   WideBackContent = "[back of wide Tile size content]",
   Count = [count],
   SmallBackgroundImage = [small Tile size URI],
   BackgroundImage = [front of medium Tile size URI],
   BackBackgroundImage = [back of medium Tile size URI],
   WideBackgroundImage = [front of wide Tile size URI],
   WideBackBackgroundImage = [back of wide Tile size URI],
};

另请参阅WP8特定的磁贴文档。 http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx