Badge Notifications in windows application
In windows applications we see that there is some stuff of type integer 1, 2 or 3 or any thing on icon's bottom what is this????? These are called the badge notifications. How they works let learn
In the same project that we have made last time make a new button now this time you have to put the buttons in the stack panel
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<Button Content="Tile button" Click="Button_Click"/>
<Button Content="Badge Notifications" Click="Button_Click_1"/>
</StackPanel>
</Grid>
Now open MainPage.xaml.cs and you will see that there is ans event for the button is generated write the following code in it
private void Button_Click_1(object sender, RoutedEventArgs e)
{
var badgeNotification = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
XmlElement badge = (XmlElement)badgeNotification.SelectSingleNode("/badge");
badge.SetAttribute("value", "20");
BadgeNotification badgenoti = new BadgeNotification(badgeNotification);
BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgenoti);
}
run the application and you will click on the button and you will see the notification 20 written on the applications icon.
Follow : fb.com/TalahMSP
No comments: