2013-03-27 52 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