2014-09-06 17 views
2

现在,我为我的应用程序生成自定义切片。但是,我想改变图块的标题,并且是动态的(例如,我可以显示当前位置)。如何在Windows Phone 8.1通用应用程序中使用新的Live Tile模板更改标题?

在WP8中,您可以设置TitleBackTitle,但这些参数似乎在通用应用程序中缺失。

任何想法如何做到这一点?我认为只能将Branding设置为BadgeIcon或app Title?我想将(Front)标题设置为一个字符串,并将标题设置为无。

/// 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()); 

亲切的问候, 尼尔斯

+0

我最终渲染的标题到图像,而转向品牌宣传还是Branding.None。 – Niels 2014-09-07 13:05:22

回答

1

只需设置属性 “品牌”:

var TileMgr = TileUpdateManager.CreateTileUpdaterForApplication(); 
    TileMgr.Clear(); 
    var tileTemplate = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Image); 

    // Quitamos el nombre de la app. 
    XmlElement tmp = tileTemplate.GetElementsByTagName("visual")[0] as XmlElement; 
    tmp.SetAttribute("branding", "none"); 
    var notification = new TileNotification(tileTemplate); 
    TileMgr.Update(notification); 
相关问题