2012-09-10 44 views
0

可以將多塊瓷磚作爲XML返回嗎? '天氣','財務'或'新聞'應用程序如何在平鋪中顯示多個結果?我試圖創建一個這樣的XML,但它沒有工作:定期更新多塊瓷磚

<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> 

回答

4

不允許將多個寬瓦片綁定(或多個正方形瓦片綁定)放入單個XML負載中。換言之,平鋪通知XML有效載荷可以包含至多一個寬瓦片綁定和至多一個正方形瓦片綁定。

也就是說,可以通過定期更新或任何其他傳遞機制(本地,推送或調度)提供多個磁貼通知。

默認情況下,圖塊只顯示最近的圖塊通知。通過enabling the tile notification queue,一次最多可爲任何給定的磁貼存儲五個磁貼通知。

定期更新然後可以配置爲使用TileUpdater.StartPeriodicUpdate或使用TileUpdater.StartPeriodicUpdateBatch從多達五個網址,在每個間隔下從一個網址下載。通過提供返回不同圖塊通知XML有效內容的網址,多個通知將顯示在圖塊上。在這裏定期更新

更多細節: http://msdn.microsoft.com/en-us/library/windows/apps/hh761476

1

你試過看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); 
     } 
    } 

如何銷PinLiveTile_Click()

編輯發現二次磚例子: 要做到定期更新見here

+0

不,我不想這樣做。我需要的是用'相同'模板發送多個貼圖。所以他們都可以出現在同一個地方。 – sedran

+0

我不確定你的意思是「同一個地方」 – mydogisbox

+0

正如Nathan在他的回答中指出的那樣,你不能在單次更新中發送多個通知。 – Denis

0

彌敦道指出,你只能有一個廣場和一個廣泛的瓦片,但看看寬瓦的範圍內(特別是TileWidePeekImageCollection06) 名單可用的瓷磚可以在這裏找到: http://msdn.microsoft.com/en-us/library/windows/apps/hh761491.aspx#TileWideImageAndText01

如果這仍然不能解決您的需求,那麼唯一的方法就是使用輔助瓷磚。

+0

該鏈接最近已更新爲包含Windows Phone 8.1更新。一些不錯的新瓷磚已被添加,並重新命名了一些瓷磚。 示例源代碼http://code.msdn.microsoft.com/windowsapps/App-tiles-and-badges-sample-5fc49148/view/SourceCode –