如何在任务栏上设置星号看起来像Skype Preview应用程序



当我创建一个项目通用应用程序时,我希望在任务栏中的图标中制作一个星号,以通知用户有关某些事件的通知。收到新消息时,它看起来像Skype Preview应用程序(它将在任务栏上显示星号)。您能帮我如何将其设置在通用应用中吗?

以下代码(来自文档)应该这样做:

private void updateBadgeGlyph() {
    string badgeGlyphValue = "alert";
    // Get the blank badge XML payload for a badge glyph
    XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);
    // Set the value of the badge in the XML to our glyph value
    Windows.Data.Xml.Dom.XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as Windows.Data.Xml.Dom.XmlElement;
    badgeElement.SetAttribute("value", badgeGlyphValue);
    // Create the badge notification
    BadgeNotification badge = new BadgeNotification(badgeXml);
    // Create the badge updater for the application
    BadgeUpdater badgeUpdater = BadgeUpdateManager.CreateBadgeUpdaterForApplication();
    // And update the badge
    badgeUpdater.Update(badge);
}

或者您可以为其使用通知散文,这也有助于创建瓷砖布局。

相关内容

最新更新