Notifications on Windows 10 using desktop app Notifications on Windows 10 using desktop app windows windows

Notifications on Windows 10 using desktop app


I used this thread to help make this code - I am sharing my success.

warning I am kind of new to C# so my code probably sucks- but it does work and is pretty simplistic and that's more than I can say for most solutions I have found

Also I was having a hell of a time getting the xml document to read. I was fighting with System.xml (I think) and Windows.Data.Dom.Xml (also not completely sure).In the end I settled on making them hard coded strings for my example file and used a switch statement to switch between them. I have found a ton of people, looking for the solution that I have come up with, on stack overflow. It seems use of the toast notification system with console or background applications would be super useful, and the documentation that surrounds the toast notification system with windows applications all suggest that it needs to be used with an application. The Action Center is super useful for notifications vrs the NotificationTray/NotifyIcon route. I have not found a full solution anywhere else on the web. Here is example code.

/*At first you need to declare that your program will be using winRT libraries:1. Right click on your yourProject, select Unload Project2. Right click on your youProject(unavailable) and click Edit yourProject.csproj3. Add a new property group:<TargetPlatformVersion>8.0</TargetPlatformVersion>4. Reload project5. Add referece Windows from Windows > Core*/using System;using Windows.Data.Xml.Dom;using Windows.Storage;using Windows.Storage.Streams;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Windows.UI.Notifications;namespace ConsoleApplication6{    public class NewToastNotification    {        public NewToastNotification(string input, int type)        {            string NotificationTextThing = input;            string Toast = "";            switch (type)            {                case 1:                    {                        //Basic Toast                        Toast = "<toast><visual><binding template=\"ToastImageAndText01\"><text id = \"1\" >";                        Toast += NotificationTextThing;                        Toast += "</text></binding></visual></toast>";                        break;                    }                default:                    {                        Toast = "<toast><visual><binding template=\"ToastImageAndText01\"><text id = \"1\" >";                        Toast += "Default Text String";                        Toast += "</text></binding></visual></toast>";                        break;                    }            }            XmlDocument tileXml = new XmlDocument();            tileXml.LoadXml(Toast);            var toast = new ToastNotification(tileXml);            ToastNotificationManager.CreateToastNotifier("New Toast Thing").Show(toast);        }}    class Program    {        static void Main(string[] args)        {            NewToastNotification Window = new NewToastNotification("Yes",1);        }    }}


Well, after the last update of the Technical Preview (the one with a notification center next to the system tray) it's working.

My notifications are showing like usual, without any code changes. They're just like normal Windows 8 style toast notifications, except these show up at the bottom.


This solution worked for me:

  • Open gpedit.msc
  • User Configuration -> Administrative Templates -> Start Menu and Taskbar -> "Disable showing balloon notifications as toasts" set to "Enabled"
  • Restart the Windows