我正在使用以下代码在设备上创建实时图块:

ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
StandardTileData newTileData = new StandardTileData
{
    BackgroundImage = new Uri(string.Format("isostore:{0}", DefaultLiveTilePath), UriKind.Absolute),
    Title = "Test"
};
tile.Update(newTileData);

稍后,我想删除实时平铺图像并将其固定后恢复为应用程序图标。这可能吗?

最佳答案

根据此blog,您应使用此代码

public void DeleteExistingTile()
{
    var foundTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DetailId=123"));

    // If the Tile was found, then delete it.
    if (foundTile != null)
    {
        foundTile.Delete();
    }
}

10-06 02:05