sedran
sedran

Reputation: 3566

Multiple Tiles in Periodic Update

Can I return multiple tiles as XML? How does 'Weather', 'Finance' or 'News' applications show multiple results in tile? I tried to create an XML like this but it didn't work:

<tile>
    <visual lang="en-US">
        <binding template="TileWideSmallImageAndText04">
            <image id="1" src="URLOFIMG" alt="alt text"/>
            <text id="1">Some Text</text>
            <text id="2">Text Field 2</text>
        </binding>
        <binding template="TileWideSmallImageAndText04">
            <image id="1" src="URL2" alt="alt text"/>
            <text id="1">SOME TEXT</text>
            <text id="2">Text Field 2</text>
        </binding>
        <binding template="TileWideSmallImageAndText04">
            <image id="1" src="URL" alt="alt text"/>
            <text id="1">TEXT</text>
            <text id="2">Text Field 2</text>
        </binding>
    </visual>
</tile>

Upvotes: 0

Views: 1553

Answers (3)

Choco Smith
Choco Smith

Reputation: 1668

As Nathan pointed out you can only have one square and one wide tile but take a look at the range of wide tile (in particular TileWidePeekImageCollection06) The list of available tile can be found here: http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx#TileWideImageAndText01

If this still doesn't solve your requirement then the only other way to do it is to use secondary tiles.

Upvotes: 0

Nathan Kuchta
Nathan Kuchta

Reputation: 14172

Placing more than one wide tile binding (or more than one square tile binding) into a single XML payload is not allowed. Put another way, a tile notification XML payload can contain at most one wide tile binding and at most one square tile binding.

That said, it is possible to provide multiple tile notifications via periodic updates, or any other delivery mechanism (local, push, or scheduled).

By default, a tile will only display the most recent tile notification. By enabling the tile notification queue, up to five tile notifications can be stored for any given tile at a time.

Periodic updates can then be configured to download on each interval from one web URL using TileUpdater.StartPeriodicUpdate, or from up to five web URLs using TileUpdater.StartPeriodicUpdateBatch. By providing URLs that return distinct tile notification XML payloads, multiple notifications will be shown on a tile.

More details on periodic updates here: http://msdn.microsoft.com/en-us/library/windows/apps/hh761476

Upvotes: 4

N_A
N_A

Reputation: 19897

Have you tried looking at the sample app?

    private void SendTileNotificationWithStringManipulation_Click(object sender, RoutedEventArgs e) 
    { 
        Button button = sender as Button; 
        if (button != null) 
        { 
            string tileXmlString = "<tile>" 
                                 + "<visual>" 
                                 + "<binding template='TileWideText04'>" 
                                 + "<text id='1'>Send to a secondary tile from strings</text>" 
                                 + "</binding>" 
                                 + "<binding template='TileSquareText04'>" 
                                 + "<text id='1'>Send to a secondary tile from strings</text>" 
                                 + "</binding>" 
                                 + "</visual>" 
                                 + "</tile>"; 

            Windows.Data.Xml.Dom.XmlDocument tileDOM = new Windows.Data.Xml.Dom.XmlDocument(); 
            tileDOM.LoadXml(tileXmlString); 
            TileNotification tile = new TileNotification(tileDOM); 

            // Send the notification to the secondary tile by creating a secondary tile updater 
            TileUpdateManager.CreateTileUpdaterForSecondaryTile(MainPage.dynamicTileId).Update(tile); 

            rootPage.NotifyUser("Tile notification sent to " + MainPage.dynamicTileId, NotifyType.StatusMessage); 
        } 
    } 

Example of how to pin secondary tiles found in PinLiveTile_Click()

Edit: To do periodic updates see here.

Upvotes: 1

Related Questions