簡體   English   中英

Windows RT和Toast通知行為

[英]Windows RT and Toast Notification behavior

你好,
我正在測試Windows RT應用程序的Toast Notification。 我在清單文件上將“ Toast Capable”設置為yes,並使用以下代碼創建一個由按鈕調用的示例方法:

var toastTemplate = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);

var text = toastTemplate.GetElementsByTagName(“ text”)[0]作為XmlElement; text.AppendChild(toastTemplate.CreateTextNode(“這是測試!”));

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

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

當我按一下該按鈕時,通知將顯示在屏幕的右上角,但沒有文本和圖像……只是帶有應用程序徽標的方框。

你能告訴我我哪里錯了嗎? 謝謝你的幫助。

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

在清單文件“ Package.manifest”中,將“前台”文本設置為“暗”。
問題在於,默認情況下,前景文本為白色。

有關圖片的問題:

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

>“為每個圖像源顯示了此步驟的版本。圖像的大小必須小於200 KB且小於1024 x 1024像素。”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM