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