Category name:Tile

Windows 8 –Live tiles

My friend Pascal (http://www.pazquality.com/) is also working on a windows 8 application. He was having trouble with getting the Live tiles to work so I volunteered to find out how to cycle to a couple of tiles and keep cycling between them.

Well, it’s surprisingly simple… Here’s the code that I wrote in the constructor of the App:

//I installed the following nuget package: http://nuget.org/packages/NotificationsExtensions.WinRT


//This will give you access to the Templates without having to go through the xml…


//Add to Tiles


var x1 = TileContentFactory.CreateTileSquareText01();

x1.TextHeading.Text = “Text 1”;


var x2 = TileContentFactory.CreateTileSquareText01();

x2.TextHeading.Text = “Text 2”;


//Make ScheduledTileNotifications out of them with a due date of 10 and 20 seconds from now…


ScheduledTileNotification n1 = new
ScheduledTileNotification(

x1.GetXml(), new
DateTimeOffset(DateTime.Now.AddSeconds(10)));


ScheduledTileNotification n2 = new
ScheduledTileNotification(

x2.GetXml(), new
DateTimeOffset(DateTime.Now.AddSeconds(20)));


//Initialize the TileUpdater


var m = TileUpdateManager.CreateTileUpdaterForApplication();


//Enable Queuing (this is what makes it cycle….)

m.EnableNotificationQueue(true);


//Add the ScheduledTileNotifications to the schedule…

m.AddToSchedule(n1);

m.AddToSchedule(n2);

The tile is now cycling through these 2 notifications…

Happy coding, pazzie!