2015-08-28 29 views
2

我能夠在我的Windows 10應用程序圖釘輔助圖塊。我試圖通過後臺任務來更新輔助磁貼。我正在嘗試使用模板TileWide310x150PeekImageCollection01,該模板應該在310x150的圖塊上顯示5張圖片(左邊一張大,右邊四張)。但它不像它想象的那樣工作。我想設置的圖片是這樣的:在Windows 10應用程序中使用圖像更新輔助圖塊

TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(mysecondarytileID); 
XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImageCollection01); 
XmlNodeList tileImageAttributes = tileXml.GetElementsByTagName("image"); 
((XmlElement)tileImageAttributes[0]).SetAttribute("src", "ms-appx://Assets/wide310x150-sdk.png"); 
((XmlElement)tileImageAttributes[1]).SetAttribute("src", "ms-appx://Assets/wide310x150-sdk.png"); 
((XmlElement)tileImageAttributes[2]).SetAttribute("src", "ms-appx://Assets/wide310x150-sdk.png"); 
((XmlElement)tileImageAttributes[3]).SetAttribute("src", "ms-appx://Assets/wide310x150-sdk.png"); 
((XmlElement)tileImageAttributes[4]).SetAttribute("src", "ms-appx://Assets/wide310x150-sdk.png"); 
TileNotification tileNotification = new TileNotification(tileXml); 
tileUpdater.Update(tileNotification); 

我猜想也許是位置圖像wrong.I試圖把在網址但這並不工作。如果我使用了另一個模板,我能夠發送文本通知。我不知道爲什麼我不能發送任何圖像到次要瓷磚。我是否在發送平鋪更新之前丟失了需要設置的內容。請幫忙。

+1

嘗試使用以'ms-appx:///'開頭而不是'ms-appx://'開頭的圖像URI(帶有三個斜槓) –

回答

4

首先,瓦片模板目錄被折舊(大多數模板繼續爲傳統目的而工作)。 我們現在推薦使用Adaptive Tile Templates,它允許您創建自己的貼圖,而不是限制爲一組模板。

其次,所有舊版圖像採集模板都不適用於Windows 10。例如,請勿在您的應用中使用TileWide310x150PeekImageCollection01。相反,用自適應模板創建一些東西。

最後,您的圖片網址無效。 ms-appx和ms-appdata之後需要三個斜槓,如ms-appx:///Assets/img.jpg。不過,這裏有一個優化 - 對於ms-appx,您可以刪除主要內容,只需要Assets/img.jpg

相關問題