问题
Is it possible to change the background color of the primary tile of my WinRT app? I'd like to change it according to app status.
I use this code for changing the text of the tile:
XmlDocument contentSmall = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text02);
contentSmall.GetElementsByTagName(textElementName)[1].InnerText = "---";
TileNotification notifSmall = new TileNotification(contentSmall);
TileUpdateManager.CreateTileUpdaterForApplication().Update(notifSmall);
回答1:
For the primary tile, the background color for most templates uses the app's color indicated in the manifest. This is done by design to promote a consistent branding via color for the app (tile, flyout panels, etc., all use the same color). However, if you use an image-only template and generate images on the fly, then of course you can use whatever colors you want.
Generally speaking, however, live tiles are not intended to be used like gadgets. App status is more rightly indicated through badges on the tile, rather than the entire tile itself.
The color limitation does not apply to secondary tiles, as they have background color and foreground text properties you can control individually.
All this applies equally to tile updates sent from the app or from a background task--they use the same API so there's nothing unique to either.
来源:https://stackoverflow.com/questions/28597017/can-i-change-the-background-color-of-the-primary-tile-in-winrt