There are three notification methods in Windows 8 to remind users in a timely manner, they are toast, tile, badge
Toast:Is in the ApplicationProgramPrompt notification.
Tile:It is a tile notification that is used to send image and text notifications on the application icons on the metro interface.
Badge:It is a tip notification on the tile. It is used to prompt the current number of new messages or current application status in the lower right corner of the application icon on the metro interface, such as playing paused newmessage.
Preparations: First, reference icationicationsextensions. winmd library, which encapsulates simplified access to various notifications.
Second, enable package. appxmanifest to reset various logos.
Finally, open package. appxmanifest and set "Toast notification supported" to "yes ".
Toast:
Private Void Toastnotice_click ( Object Sender, routedeventargs e ){ // Toast notification text and image settings Itoastimageandtext01 toast = Toastcontentfactory. createtoastimageandtext01 (); toast. textbodywrap. Text = " The last 10 days of today's end of the world! " ; Toast. image. SRC = " Http://news.shangdu.com/301/20120512/P_5626361_0__1686841290.jpg " ; Toastnotificationmanager. createtoastnotifier (). Show (toast. createnotification ());}
Slice:
Tile:
Private Void Tilenotice_click ( Object Sender, routedeventargs e ){ // Tile notification text and image settings Itilewideimageandtext01 tile = Tilecontentfactory. createtilewideimageandtext01 (); Tile. textcaptionwrap. Text = " Petty capital has a special liking for 10 joint venture popular fashion model shopping guides " ; Tile. image. SRC =" Http://news.mycar168.com/uploadfile/2011/1030/20111030040816628.jpg " ; Itilesquareimage wideimagecontent = Tilecontentfactory. createtilesquareimage (); wideimagecontent. image. SRC = " Http://news.mycar168.com/uploadfile/2011/1030/20111030040816628.jpg " ; Tile. squarecontent = Wideimagecontent; tileupdatemanager. createtileupdaterforapplication (). Update (tile. createnotification ());} Private Void Cleartile_click ( Object Sender, routedeventargs e ){ // Clearing tile notifications Tileupdatemanager. createtileupdaterforapplication (). Clear ();}
Slice:
Badge:
Private Void Badgenotice_click ( Object Sender, routedeventargs e ){ // Badge digital notification Badgenumericnotificationcontent badge = New Badgenumericnotificationcontent ( 29 ); Badgeupdatemanager. createbadgeupdaterforapplication (). Update (badge. createnotification ());} Private Void Badgeimage_click ( Object Sender, routedeventargs e ){ // Badge status image notification Badgeglyphnotificationcontent badge = New Badgeglyphnotificationcontent (glyphvalue. paused); badgeupdatemanager. createbadgeupdaterforapplication (). Update (badge. createnotification ());} Private Void Badgeclear_click ( Object Sender, routedeventargs e ){ // Clear badge notifications Badgeupdatemanager. createbadgeupdaterforapplication (). Clear ();}
For the image effect, see the bottom right corner of the image:
XAML:
<Grid background = " {Staticresource applicationpagebackgroundthemebrush} " > <Button content = " Toast notification " Horizontalalignment = " Left " Name = " Toastnotice " Margin = " 250,172, 0, 0 " Verticalalignment = " Top " Click = " Toastnotice_click " /> <Button content = " Tile notification " Horizontalalignment = " Left " Name = " Tilenotice " Margin = " 394,172, 0, 0 " Verticalalignment = " Top " Click = " Tilenotice_click " /> <Button content = " Clearing tile notifications " Horizontalalignment = " Left " Name = " Cleartile " Margin = " 559,172, 0, 0 " Verticalalignment = " Top " Click = " Cleartile_click " /> <Button content = " Badge number " Horizontalalignment = " Left " Name = " Badgenotice " Margin = " 250,270, 0, 0 " Verticalalignment = " Top " Click =" Badgenotice_click " /> <Button content = " Badge Image " Horizontalalignment = " Left " Name = " Badgeimage " Margin = " 394,270, 0, 0 " Verticalalignment = " Top " Click = " Badgeimage_click " /> <Button content = " Badge clear " Horizontalalignment = " Left " X: Name = " Badgeclear " Margin = " 559,270, 0, 0 " Verticalalignment = " Top " Click = " Badgeclear_click " /> </GRID>
Click win8notice.rar to download the source code.