My app's primary tile has live tile capabilities. If however I turn off the live tile functionality, when I return to the Start screen, my app's primary tile is still showing the last state of the live tile.
I was wondering what I need to do in order to restore my app's primary tile to its static state as soon as I turn the live tile functionality off? At the moment, I need to resize the tile or remove/re-insert it to get this effect.
This is the code that runs when I turn off the live tile:
// Remove the Background Agent for the live tile.
ScheduledActionService.Remove("PeriodicTaskForLocation");
// Update tile.
RadFlipTileData extendedData = new RadFlipTileData()
{
WideVisualElement = null,
WideBackVisualElement = null,
IsTransparencySupported = true
};
ShellTile tile = ShellTile.ActiveTiles.First();
if (tile != null)
{
tile.Update(extendedData);
LiveTileHelper.UpdateTile(tile, extendedData);
}
This has done the trick:
// Remove the Background Agent for the live tile.
RemoveAgent("PeriodicTaskForLocation");
// Delete tile.
ShellTile tile = ShellTile.ActiveTiles.First();
if (tile != null)
{
RadFlipTileData extendedData = new RadFlipTileData();
extendedData.IsTransparencySupported = true;
extendedData.WideBackgroundImage = new Uri("/Assets/Tiles/Icon.png", UriKind.Relative);
extendedData.WideBackVisualElement = null;
LiveTileHelper.UpdateTile(tile, extendedData);
}