Jaa


Pop a simple, local toast notification

Eliot  Eliot Cowley, Content Developer


Here is how to create a text-only local toast notification in a Windows 10 UWP app.

using Windows.Data.Xml.Dom; using Windows.UI.Notifications; using Windows.UI.Xaml.Controls; private static void ShowToast(string title, string content) {  XmlDocument toastXml = new XmlDocument();  string xml = $@"   <toast activationType='foreground'>   <visual>     <binding template='ToastGeneric'>      <text>{title}</text>      <text>{content}</text>     </binding>    </visual>   </toast>";  toastXml.LoadXml(xml);  ToastNotification toast = new ToastNotification(toastXml);  ToastNotificationManager.CreateToastNotifier().Show(toast); }

See also

Comments

  • Anonymous
    June 03, 2016
    very simple.