我正在使用此代码在我的应用程序中显示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);
我的问题是当烤面包显示时,有一个小徽标(天蓝色):
如何隐藏此徽标?
答案 0 :(得分:2)
更新1
根据Programming Windows® 8 Apps with HTML, CSS, and JavaScript by Microsoft Press There are no means to override this; the branding attribute in the XML is ignored for toasts.
您必须将branding
attributte设置为none
,默认为logo
。请参阅here,尝试下面给出的代码。
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);