I currently have the code below that creates a custom layout for the Tile. It only resizes to the small and medium and not the wide.
I need to update the code to support the wide tile of Windows Phone 8, but I need to be able to customise where the text appears.
The code uses a template where I can change the background of the tile and the position of the text.
Any ideas on how I can make this go into a wide tile? And also to be able to out in multiple lines of text.
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(busStopName.Text));
TileControl frontTile = new TileControl();
TileName = "";
TileName = busStopName.Text;
TileData tileData = new TileData() {Text1 = busStopName.Text };
frontTile.DataContext = tileData;
frontTile.Measure(new Size(173, 173));
frontTile.Arrange(new Rect(0, 0, 173, 173));
var bmp = new WriteableBitmap(173, 173);
bmp.Render(frontTile, null);
bmp.Invalidate();
var isf = IsolatedStorageFile.GetUserStoreForApplication();
var filename = "/Shared/ShellContent/" + busStopName.Text + ".jpg";
using (var stream = isf.OpenFile(filename, System.IO.FileMode.OpenOrCreate))
{
bmp.SaveJpeg(stream, 173, 173, 0, 100);
}
var data = new StandardTileData
{
BackgroundImage = new Uri("isostore:/Shared/ShellContent/" + busStopName.Text + ".jpg", UriKind.Absolute)
};
ShellTile.Create(new Uri("/LiveTimes.xaml?name=" + busStopName.Text, UriKind.Relative), data);
The ShellTile has additional overload for create that allows optional Boolean argument specifying whether wide tile is supported or not. You need to use that to support wide tile.
have a look at my blogpost http://invokeit.wordpress.com/2013/05/09/fliptile-cycletile-and-various-iterations-of-wpdev-sdks/
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207919(v=vs.105).aspx
Btw you need to use one of the new tile templates like FlipTileData and pass that. StandardTileData cannot support wide and is inherited from #wp7.5
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206971(v=vs.105).aspx
FlipTileData TileData = new FlipTileData()
{
Title = "[title]",
BackTitle = "[back of Tile title]",
BackContent = "[back of medium Tile size content]",
WideBackContent = "[back of wide Tile size content]",
Count = [count],
SmallBackgroundImage = [small Tile size URI],
BackgroundImage = [front of medium Tile size URI],
BackBackgroundImage = [back of medium Tile size URI],
WideBackgroundImage = [front of wide Tile size URI],
WideBackBackgroundImage = [back of wide Tile size URI],
};
ShellTile.Create(new Uri("/LiveTimes.xaml?name=" + busStopName.Text, UriKind.Relative), TileData, true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.