Creating Badge Tile In Windows Apps

Here are the steps: 

Step 1

I’m going to show in Windows Phone 8.1 apps. Same thing applies in Windows apps too. Firstly, create a Blank Windows Phone 8.1 Project.

Step 2

In the MainPage.xaml, add a button with click event to perform our task.

Complete XAML Code
  1. <Page    
  2. x:Class="BadgeTile.MainPage"  
  3.     xmlns=""  
  4.     xmlns:x=""  
  5.     xmlns:local="using:BadgeTile"  
  6.     xmlns:d=""  
  7.     xmlns:mc=""    
  8. mc:Ignorable="d"    
  9. Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  
  10.     <Grid Background="#FF3372D3">  
  11.         <Button Name="btnCreateBadge" Click="btnCreateBadge_Click" Margin="129,41,0,542">Create Badge</Button>  
  12.     </Grid>  
  13. </Page>    
Step 3

There are different types of badge or glyph available for us. In the Code behind MainPage.xaml.cs, Update your click event code with the following,
  1. private void btnCreateBadge_Click(object sender, RoutedEventArgs e)  
  2. {  
  3.     var xmlBadge = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);  
  4.     var badge = xmlBadge.SelectSingleNode("/badge"as XmlElement;  
  5.     badge.SetAttribute("value""9");  
  6.     var badgeNotification = new BadgeNotification(xmlBadge);  
  7.     BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification);  
  8. }  
Step 4

Run your application in your Windows Phone device or emulator and click on the Create Badge button. Pin your app to the start menu and you will see the Badge number in your Tile.

You can get the complete source code from GitHub also.