Back when the developer preview of Windows 8 came out I did some blog posts on how to use the tile notification capability in new style WinRT apps. I have been going back over these posts to see what, if anything, has changed between then and the RTM release of Windows 8.
Metro App Tile Notification
The code in the original post works pretty much the same in the RTM version but I did run into one odd problem. In my original post I used the following line of code to get the XML node from the tile template:
var textNode = xmlTemplate.SelectSingleNode("/title/visual/binding/text[@id='1']");
In the RTM this doesn’t work, the node is not be found. It turns out that this is the expected behavior since the SelectSingleNode method required the XML to have a namespace, otherwise it won’t find the node. I am not sure why this worked in the developer preview. There are ways to get around the missing namespace, but there is an easier solution:
var textNode = xmlTemplate.GetElementsByTagName("text")[0];
This line achieves the same thing and doesn’t have the namespace issue. Other then this change everything in the original post works fine.
No comments:
Post a Comment