2
votes

I have been struggling to figure out how to change the background color of the WP8 tile associated with my app. I have tried setting the BackgroundColor attribute in the WMAppManifest.xml under the TemplateIconic tag using the following formats...

AARRGGBB

RRGGBB

Neither of these seems to work, the tile is always the current accent color set on the phone. Can someone just point me in the right direction? Thanks in advance.

2
Comments from this post indicate that you have to use the format #RRGGBB. - Simon Má¶œKenzie
I am using #RRGGBB, sorry forgot to include the # in my post. - agolia

2 Answers

0
votes

According to Microsoft, the value must be #AARRGGBB. But I can't get it to work with any value. It seems to just ignore it. http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207009(v=vs.105).aspx

"If the BackgroundColor element's color value does not begin with #FF, such as #FF524742, your custom background color will not display and the default theme color will display instead. "

1
votes

You can use something like this to set all the properties of your application tile, including the BackgroundColor property.

//REFERENCE: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207009(v=vs.105).aspx
// Set all the properties of the Application Tile.
private void SetApplicationTile()
{
    // Application Tile is always the first Tile, even if it is not pinned to Start.
    ShellTile TileToFind = ShellTile.ActiveTiles.First();

    // Application should always be found
    if (TileToFind != null)
    {
        IconicTileData TileData = new IconicTileData()
        {
            Title = "My App title",
            WideContent1 = "New Wide Content 1",
            WideContent2 = "New Wide Content 2",
            WideContent3 = "New Wide Content 3",
            //Count = 2,
            //BackgroundColor = Colors.Blue, 
            //BackgroundColor = new Color { A = 255, R = 200, G = 148, B = 255 },
            //BackgroundColor = Color.FromArgb(255, 200, 148, 55),
            //BackgroundColor = (Color)Application.Current.Resources["PhoneAccentColor"],
            BackgroundColor = HexToColor("#FF7A3B3F"),
            IconImage = new Uri("Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative),
            SmallIconImage = new Uri("Assets/Tiles/IconicTileSmall.png", UriKind.Relative),
        };

        // Update the Application Tile
        TileToFind.Update(TileData);
    }
}

public static Color HexToColor(string hex)
{
    return Color.FromArgb(
        Convert.ToByte(hex.Substring(1, 2), 16),
        Convert.ToByte(hex.Substring(3, 2), 16),
        Convert.ToByte(hex.Substring(5, 2), 16),
        Convert.ToByte(hex.Substring(7, 2), 16)
        );
}

IMPORTANT NOTE

If you do not set the A parameter of the BackgroundColor property to 255, your custom background color will not display, and the default theme color will display instead.