2

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.

4

2 に答える 2

1

このようなものを使用して、BackgroundColor プロパティを含むアプリケーション タイルのすべてのプロパティを設定できます。

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

重要な注意点

BackgroundColor プロパティの A パラメータを 255 に設定しない場合、カスタムの背景色は表示されず、代わりにデフォルトのテーマ カラーが表示されます。

于 2013-05-21T04:35:31.223 に答える
0

Microsoft によると、値は #AARRGGBB でなければなりません。しかし、私はそれを任意の値で動作させることができません。無視するしかないようです。http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207009(v=vs.105).aspx

"BackgroundColor 要素の色の値が #FF で始まらない場合 (#FF524742 など)、カスタムの背景色は表示されず、代わりにデフォルトのテーマ色が表示されます。"

于 2013-04-26T19:21:36.320 に答える