如何在Windows Phone 8.1中以编程方式创建磁贴?

时间:2014-07-28 14:27:27

标签: windows-phone-8.1 live-tile

在Windows Phone 8中,我能够使用以下内容创建Shell Tile:

StandardTileData newTileData = new StandardTileData
{
    BackgroundImage = new Uri("/Images/my_tile_medium.png", UriKind.Relative),
    Title = "My Tile Title",
    BackTitle = "My Tile Back",
    BackBackgroundImage = new Uri("/Images/my_tile_medium_back.png", UriKind.Relative),
};

ShellTile.Create(MyAppPages.MainPage("Name=MyAppTile"), newTileData);

这在Windows Phone 8.1中不再有效。如何以编程方式使用Windows Phone 8.1创建磁贴

1 个答案:

答案 0 :(得分:1)

在WP8.1运行时中,您可以使用SecondaryTile,例如:

SecondaryTile tileData = new SecondaryTile()
{
    TileId = "MyTileID",
    DisplayName = "MyTilesTitle",
    Arguments = "Some arguments"
};
tileData.VisualElements.Square150x150Logo = new Uri("uri to image");
tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
await tileData.RequestCreateAsync();

某些指南您也可以找到here at MSDN