I'm creating a live tile on the device with the following code:
ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
StandardTileData newTileData = new StandardTileData
{
BackgroundImage = new Uri(string.Format("isostore:{0}", DefaultLiveTilePath), UriKind.Absolute),
Title = "Test"
};
tile.Update(newTileData);
At a later point I would like to delete the live tile image and have it revert to the app icon when pinned. Is this possible?
I'm using the following code when resetting my tile back to normal everytime the app starts:
private void ResetLiveTileToNormal()
{
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault();
ShellTileData shellData = new StandardTileData
{
Title = "XXXXXXXX",
Count = 0,
BackContent = "",
BackTitle = "",
BackBackgroundImage = new Uri("", UriKind.Relative),
BackgroundImage = new Uri(@"/Images/LiveTiles/XXXXXX.png", UriKind.Relative)
};
TileToFind.Update(shellData);
}
According to this blog you shoudl use this code
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();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With