【发布时间】:2013-03-17 17:57:31
【问题描述】:
你好,
我正在测试 Windows RT 应用程序的 Toast 通知。我在清单文件上将“Toast Capable”设置为是,并创建了一个由按钮调用的示例方法,其中包含以下代码:
var toastTemplate = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);
var text = toastTemplate.GetElementsByTagName("text")[0] as xml元素; text.AppendChild(toastTemplate.CreateTextNode("这是 测试!"));
var image = toastTemplate.GetElementsByTagName("image")[0] as xml元素; image.SetAttribute("src", String.Format("ms-appx:///{0}", "图片/rss_logo.png"));
ToastNotification toastNotification = new ToastNotification(toastTemplate); ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier(); toastNotifier.Show(toastNotification);
当我点击按钮时,通知出现在屏幕的右上角,但没有文字和图像...只有框,带有应用程序的徽标。
你能告诉我哪里错了吗? 感谢您的帮助。
【问题讨论】:
标签: c# xaml windows-8 notifications