Quantcast
Channel: Randy Riness @ SPSCC aggregator
Viewing all articles
Browse latest Browse all 3015

MSDN Blogs: Pop a simple, local toast notification

$
0
0

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


Viewing all articles
Browse latest Browse all 3015

Trending Articles