【问题标题】:Windows RT and Toast Notification behaviorWindows RT 和 Toast 通知行为
【发布时间】: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


    【解决方案1】:

    关于第一个问题(文字不出现):

    在清单文件“Package.manifest”中,我将前景文本设置为“深色”。
    问题是默认情况下,前景文本是白色的。

    图片问题:

    我的图像格式不正确,并且不在正确的目录中。在 MS 快速入门 ([http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh868254(v=win.10).aspx][1]) 中,它说:

    > " 此步骤的版本针对每个图像源显示。图像必须 > 大小小于 200 KB 且小于 1024 x 1024 像素。 "

    【讨论】:

    • 你达到了你想要的还是这个问题仍然悬而未决?
    • 是的,解决了。但是我不能关闭它直到明天......(系统拒绝并要求我等待2天才能关闭它)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 1970-01-01
    • 2017-08-13
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多