【发布时间】:2015-09-19 22:17:32
【问题描述】:
现在,我正在为我的应用生成自定义图块。但我也想动态更改磁贴的标题(例如,我可以显示当前位置)。
在 WP8 中,您可以设置 Title 和 BackTitle,但在通用应用程序中似乎缺少这些参数。
知道如何做到这一点吗?我认为只能将Branding 设置为BadgeIcon 或应用程序标题?我想将 (Front)Title 设置为一个字符串,并将返回标题设置为空。
/// RENDERING THE TILES
string WideFrontTile = await RenderWideFront(WeatherData);
string MediumFrontTile = await RenderMediumFront(WeatherData);
string WideBackTile = await RenderWideBack(WeatherData);
string MediumBackTile = await RenderMediumBack(WeatherData);
// FRONT TILES
ITileWide310x150Image WideFrontContent = TileContentFactory.CreateTileWide310x150Image();
WideFrontContent.Image.Src = WideFrontTile;
ITileSquare150x150Image MediumFrontContent = TileContentFactory.CreateTileSquare150x150Image();
MediumFrontContent.Image.Src = MediumFrontTile;
WideFrontContent.Square150x150Content = MediumFrontContent;
// BACK TILES
ITileWide310x150Image WideBackContent = TileContentFactory.CreateTileWide310x150Image();
WideBackContent.Image.Src = WideBackTile;
ITileSquare150x150Image MediumBackContent = TileContentFactory.CreateTileSquare150x150Image();
MediumBackContent.Image.Src = MediumBackTile;
WideBackContent.Square150x150Content = MediumBackContent;
// Clear all tiles, push new tiles
TileUpdateManager.CreateTileUpdaterForApplication().Clear();
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().Update(WideBackContent.CreateNotification());
TileUpdateManager.CreateTileUpdaterForApplication().Update(WideFrontContent.CreateNotification());
亲切的问候, 尼尔斯
【问题讨论】:
-
我最终将标题渲染到图像中,同时将 Branding 变为 Branding.None。
标签: c# live-tile win-universal-app