This "tip" shows the basic mechanics used to create a basic live tile notification using text.
To start, I created a click event in XAML code which kicked off an event to send a simple text message to the application tile.
To find out how to use images for your tiles see:
Use this article to figure out how to write the code needed to send a message or notification to a Live Tile in Windows 8.
Create a new C++ Blank XAML project and add the images as shown in the articles referenced.
Use your own images that meet the requirements as shown in the article.
Using the code
Build the C++ application in Visual Studio 2012 Express or Visual Studio 2012 Pro/Premium/Ultimate version.
- Run the code, either in the simulator or on a Windows 8 machine, push the windows/flag key and look for your application, note the tile on the "Start" screen.
- Then go back to the running application, click the "Send Link" button.
- Push the windows/flag key to go back to the "Start" screen, if there has been no change, wait a few seconds and you will see the text appear (in this case the word: Boo, because it is so scary easy).
- For more explanation see my blog at: http://aka.ms/tilenotification
using namespace LiveTileFun;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::Notifications;
using namespace Windows::Data::Xml::Dom;
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
(void) e; }
void LiveTileFun::MainPage::DemoTile1(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
XmlDocument^ tileXml = TileUpdateManager::GetTemplateContent(TileTemplateType::TileSquareText01);
XmlNodeList^ tileTextAttributes = tileXml->GetElementsByTagName("text");
tileTextAttributes->Item(0)->InnerText = "Boo!";
TileNotification^ tileNotification = ref new TileNotification(tileXml);
Points of Interest
Be careful, if you try to use a Tile template enumeration that doesn't match what is avaiable in the tile, it will fail silently. What does that mean? If you send a square tile notification to a wide tile, then nothing will happen. Also, there is a little latency in the message sending so make sure to wait a few seconds if you don't see the notification.
Sam Stokes works for Microsoft as a technology evangelist and is focused on working with colleges, students and professors.