2013-03-27 51 views
0

Windows RT和Toast通知行爲

您好,
我正在測試Windows RT應用程序的Toast Notification。餘設置清單文件中的爲yes「吐司有能力」,並且創建由一個按鈕被稱爲樣品的方法,與此代碼內:

變種toastTemplate = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);

var text = toastTemplate.GetElementsByTagName(「text」)[0] as XmlElement; text.AppendChild(toastTemplate.CreateTextNode(「這是 測試!」));

var image = toastTemplate.GetElementsByTagName(「image」)[0] as XmlElement; image.SetAttribute(「src」,String.Format(「ms-appx:/// {0}」, 「Images/rss_logo.png」));

ToastNotification toastNotification = new ToastNotification(toastTemplate); ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();toastNotifier.Show(toastNotification);

當我清除按鈕,通知出現在屏幕的右上角,但沒有文字和圖像...只是框中,與應用程序的標誌。

你能告訴我我哪裏錯了嗎? 感謝您的幫助。

回答

0

關於第一個問題(文本不會出現):

清單文件「Package.manifest」,我設置前景色文本「黑暗」。
問題是,默認情況下,前景文字是白色的。

關於圖片的問題:

我的形象是不正確的格式,而不是在正確的目錄。在MS QuickStart([http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh868254(v = win.10).aspx] [1])中,它表示:

「示出此步驟的版本爲每個圖像源。圖片必須 >小於200 KB的大小和小於1024×1024像素。」 >

+0

有你取得你期望什麼或這個問題仍然開放? – Suny 2013-03-28 10:51:06

+0

是的,它解決了。但是我不能在明天之前關閉它(系統拒絕並要求我在關閉之前等待2天)。 – Xstahef 2013-03-28 11:21:40