【问题标题】:Hide the small logo in the toast notification windows 8隐藏吐司通知窗口中的小标志 8
【发布时间】:2013-05-31 14:08:51
【问题描述】:

我正在使用此代码在我的应用程序中显示 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);

我的问题是当显示吐司时,有一个小标志(天蓝色):

如何隐藏此徽标?

【问题讨论】:

    标签: xaml microsoft-metro winrt-xaml toast


    【解决方案1】:

    更新 1

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


    您必须将branding 属性设置为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);
    

    【讨论】:

    • 这还能用吗?我添加了“品牌”属性,但图标仍在显示
    猜你喜欢
    • 2019-07-02
    • 2011-09-24
    • 2014-10-18
    • 2016-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多