Windows Phone 8.1 Development: Magnets | Tile update

Source: Internet
Author: User

Source: http://www.bcmeng.com/tile/

Previous article to share the toast notification operation method, this article we will look at the Windows Phone 8.1 development of the magnet update. Magnets are a great highlight of Windows Phone Small dreams I also like very much. and updating the magnets is also a feature that many applications require. In fact, the method of updating the magnets and the toast notification is almost the same, because they are essentially an XML file.

Select a magnet Template:

There are many templates for magnets, so you can browse: http://msdn.microsoft.com/zh-cn/library/windows/apps/xaml/ Windows.ui.notifications.tiletemplatetype.aspx. This example selects a template:

tilesquare150x150peekimageandtext02. Concrete look at the end will have, one side is the picture, the back is the text. There are two parts of the text.

Its XML structure is as follows:

<tile> <visual version="2"> <binding template="tilesquare150x150peekimageandtext02"fallback="TileSquarePeekImageAndText02"> <image id="1"Src="Image1"alt="alt Text"/> <text id="1">text Field1(larger text) </text> <text id="2">text Field2</text> </binding> </visual></tile>

The code for selecting the template is as follows:

XmlDocument tilexml = tileupdatemanager.gettemplatecontent (tiletemplatetype.tilesquare150x150peekimageandtext02);
Provide text content for magnets
  XmlNodeList tiletextattributes = Tilexml.getelementsbytagname ("text");            tiletextattributes[0" small Dream ";            tiletextattributes[1" programming Small Dream welcome you ";
Providing images for magnets
XmlNodeList tileimageattributes = Tilexml.getelementsbytagname ("image"); ((XmlElement) tileimageattributes[0]). SetAttribute ("src""ms-appx:///assets/bcmeng.png");
To create a magnet:
New Tilenotification (Tilexml);
Set the magnet expiry time:
  Tilenotification.expirationtime = DateTimeOffset.UtcNow.AddHours (in);
Send notifications to App tiles
  Tileupdatemanager.createtileupdaterforapplication (). Update (tilenotification);

Windows Phone 8.1 Development: Magnets | Tile update

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.