2

我正在使用此代码在我的应用程序中显示 toastnotifcation:

var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);
var image = toastXml.GetElementsByTagName("image")[0];
var title = toastXml.GetElementsByTagName("text")[0];

var text = toastXml.GetElementsByTagName("text")[1];

image.Attributes[1].AppendChild(toastXml.CreateTextNode("ms-appx:///Assets/Images/logovboardnotif.png"));

title.AppendChild(toastXml.CreateTextNode("Board"));

text.AppendChild(toastXml.CreateTextNode(message));


var toastnotifier = ToastNotificationManager.CreateToastNotifier();

var toastnotification = new ToastNotification(toastXml);

toastnotifier.Show(toastnotification);

我的问题是当显示吐司时,有一个小标志(天蓝色): 在此处输入图像描述

我怎样才能隐藏这个标志?

4

1 回答 1

3

更新 1

根据Microsoft Press 的 Programming Windows® 8 Apps with HTML, CSS, and JavaScript There are no means to override this; the branding attribute in the XML is ignored for toasts.


您必须将branding属性设置为none,默认为logo。请参阅此处尝试以下给定的代码。

var xml = @"<toast>
                <visual>
                    <binding template=""ToastImageAndText02"" branding=""none"">
                        <image id=""1"" src=""{0}""/>
                        <text id=""1"">{1}</text>
                        <text id=""2"">{2}</text>
                    </binding>  
                </visual>
            </toast>";

xml = string.Format(xml, "ms-appx:///Assets/Images/logovboardnotif.png", "Board", message);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
var toastnotification = new ToastNotification(xmlDoc);
ToastNotificationManager.CreateToastNotifier().Show(toastnotification);
于 2013-05-31T16:55:20.933 回答