Quickstart: Sending a local toast notification and handling activations (Windows 10)

A toast notification is a message that an app can construct and deliver to the user while he/she is not currently inside your app. This Quickstart walks you through the steps to create, deliver, and display a Windows 10 toast notification with the new adaptive templates and interactive actions. These actions are demonstrated through a local notification, which is the simplest notification to implement. We will go through the following things:

Sending a toast

  • Specifying the new flexible template for your notification;
  • Constructing the visual part (text and image) of the notification;
  • Adding actions to the notification to make it interactive, and providing activation type, and contextual information used when your app is activated by these actions;
  • Setting an expiration time on the toast so it no longer shows up in user’s action center once gone stale;
  • Providing identity to your toast so it can be replaced/removed at a later time;
  • Sending your toast as a local notification.

Handling activation from a toast

  • Handling activation when the body of the toast is tapped;
  • Handling foreground activation for interactive toast notification;
  • Handling background activation for interactive toast notification;

Keep toast and tile/badge in sync, and more

  • Getting notified when your app’s toast notifications are removed by user, expired by system, or added from your app server;
  • Using the History property to get the list of toast notifications from your app that is currently displayed in action center;
  • Updating your tile information to match what’s inside action center, and more;


To fully understand the content and some context of this topic, the below blog posts will be helpful:

Note: Different from Windows 8/8.1, you no longer need to declare in your app’s manifest that your app is capable of showing toast notifications. All apps are capable of sending and displaying toast notifications.

Note: The example below will be using C# as the programming language.

Sending a toast

1. Install NuGet packages

We recommend installing the two following NuGet packages to your project. Our code sample will use these packages. We’ll also provide the “Vanilla” code snippets that don’t use any NuGet packages.

2. Add namespace declarations

Windows.UI.Notifications includes the toast APIs.

using Windows.UI.Notifications;
using Microsoft.Toolkit.Uwp.Notifications; // Notifications library
using Microsoft.QueryStringDotNET; // QueryString.NET
using Windows.UI.Notifications;
using Windows.Data.Xml.Dom;

3. Construct the notification payload

In Windows 8/8.1, you used to be required to choose a template from the system-provided template catalog that fits the needs of your content – one of the templates in ToastTemplateType enumeration. In Windows 10, that’s not the case anymore. The number of text lines, optional profile picture that replaces the logo, and optional inline picture, can all be managed by using the new flexible and adaptive toast templates – ToastGeneric. See the adaptive and interactive toast documentation for more information.

Constructing the visual part of the payload

Let’s start by constructing the visual part of the payload, which includes the text and image content you want the user to see.

Thanks to the the Notifications library, generating the XML payload is much easier. If you don’t install the Notifications library from NuGet, you have to construct the XML manually, which leaves room for errors.

Note: Images can be used from the app’s package, the app’s local storage, or from the web. Images must be less than 200 KB in size.

// In a real app, these would be initialized with actual data
string title = "Andrew sent you a picture";
string content = "Check this out, Happy Canyon in Utah!";
string image = "http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-81-permanent/2727.happycanyon1_5B00_1_5D00_.jpg";
string logo = "ms-appdata:///local/Andrew.jpg";

// Construct the visuals of the toast
ToastVisual visual = new ToastVisual()
    BindingGeneric = new ToastBindingGeneric()
        Children =
            new AdaptiveText()
                Text = title

            new AdaptiveText()
                Text = content

            new AdaptiveImage()
                Source = image

        AppLogoOverride = new ToastGenericAppLogo()
            Source = logo,
            HintCrop = ToastGenericAppLogoCrop.Circle
// In a real app, these would be initialized with actual data
string title = "Andrew sent you a picture";
string content = "Check this out, Happy Canyon in Utah!";
string image = "http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-81-permanent/2727.happycanyon1_5B00_1_5D00_.jpg";
string logo = "ms-appdata:///local/Andrew.jpg";

// TODO: all values need to be XML escaped

// Construct the visuals of the toast
string toastVisual =
  <binding template='ToastGeneric'>
    <image src='{image}'/>
    <image src='{logo}' placement='appLogoOverride' hint-crop='circle'/>

Constructing actions part of the payload

Now let’s add interactions to the payload.

In the below example, we included an input element that allows the user to input text, which can then be retrieved by the app using its id, once it is activated in the foreground or background – depending on how the interactions are defined for each of the actions.

We then created 2 action elements, each specifying its own activation type, content, and arguments.

  • Content attribute is used to specify the text on the button, when they are rendered to represent the actions;
  • activationType is used to specify how the app wants to be activated when this action is performed by the user, you can choose to launch your app in the foreground, launch a background task, or protocol launch another app. Whether your app chooses the activation type to be foreground or background, there is always a way for you to retrieve the user input, as well as the args you pre-defined in the arguments attribute, so you have the full context of what the user did to the notification. 
// In a real app, these would be initialized with actual data
int conversationId = 384928;

// Construct the actions for the toast (inputs and buttons)
ToastActionsCustom actions = new ToastActionsCustom()
    Inputs =
        new ToastTextBox("tbReply")
            PlaceholderContent = "Type a response"

    Buttons =
        new ToastButton("Reply", new QueryString()
            { "action", "reply" },
            { "conversationId", conversationId.ToString() }

            ActivationType = ToastActivationType.Background,
            ImageUri = "Assets/Reply.png",

            // Reference the text box's ID in order to
            // place this button next to the text box
            TextBoxId = "tbReply"

        new ToastButton("Like", new QueryString()
            { "action", "like" },
            { "conversationId", conversationId.ToString() }

            ActivationType = ToastActivationType.Background

        new ToastButton("View", new QueryString()
            { "action", "viewImage" },
            { "imageUrl", image }

// In a real app, these would be initialized with actual data
int conversationId = 384928;

// Generate the arguments we'll be passing in the toast
string argsReply = $"action=reply&conversationId={conversationId}";
string argsLike = $"action=like&conversationId={conversationId}";
string argsView = $"action=viewImage&imageUrl={Uri.EscapeDataString(image)}";

// TODO: all args need to be XML escaped

string toastActions =

      placeHolderContent='Type a response'/>





Combining the above to construct the full payload

The construction of the XML payload is now complete, and we can use it to instantiate your ToastNotification object.

Note: you can also provide an activation type inside the root element, to specify what type of activation needs to happen when the user taps on the body of the toast notification. Normally, tapping the body of the toast should launch your app in the foreground to create a consistent user experience, but you can use other activation types to fit your specific scenario where it makes most sense to the user.

Just like before, you can and should always add a launch parameter to the root element, so when user taps the body of the toast, your app can still be launched with a view that relates to the content of the notification.  

// Now we can construct the final toast content
ToastContent toastContent = new ToastContent()
    Visual = visual,
    Actions = actions,

    // Arguments when the user taps body of toast
    Launch = new QueryString()
        { "action", "viewConversation" },
        { "conversationId", conversationId.ToString() }


// And create the toast notification
var toast = new ToastNotification(toastContent.GetXml());
// Now we can construct the final toast content
string argsLaunch = $"action=viewConversation&conversationId={conversationId}";

// TODO: all args need to be XML escaped

string toastXmlString =
$@"<toast launch='{argsLaunch}'>

// Parse to XML
XmlDocument toastXml = new XmlDocument();

// Generate toast
var toast = new ToastNotification(toastXml);

4. Providing expiration time to toast notification

In Windows 10, all toast notifications go in action center (which was previously only available on phone, but now available on all Windows devices) after they are dismissed or ignored by the user when it pops up on the screen for the first time, so the users no longer misses notifications from your app.

However, if the message in your notification is only available, or relevant for a period of time, you should set an expiration time on the toast notification so the users do not see stale information from your app. In the code below I set the expiration time to be 2 days.

toast.ExpirationTime = DateTime.Now.AddDays(2);

5. Providing identity and group id to toast notification

Just like in Windows Phone 8.1, you can provide identity to a toast notification, in order to target it at a later time, for the purposes of replacing or removing it, as shown below.

To see more details on replacing/removing already delivered toast notifications, please see Quickstart: Managing toast notifications in action center (XAML).

toast.Tag = "1";
toast.Group = "wallPosts";

6. Send the toast notification


7. IMPORTANT: Clearing your notifications

UWP apps are responsible for removing and clearing their own notifications. When your app is launched, we do NOT automatically clear your notifications.

The only times that Windows will automatically remove notification(s) are…

  • When a user taps a notification: that specific single notification is removed and activation is performed (but all the others still remain in Action Center).
  • When the user taps your app’s header in Action Center: all of your app’s notifications will be cleared while your app is launched.

Here’s an example of what a messaging app should do…

  1. User receives multiple toasts about new messages in a conversation
  2. User taps one of those toasts to open the conversation
  3. The app opens the conversation and then clears all toasts for that conversation (by using Remove on the app-supplied tag for that conversation)
  4. User’s Action Center now properly reflects the notification state, since there are no stale notifications for that conversation left in Action Center.

To learn about clearing all notifications or removing specific notifications, see Quickstart: Managing toast notifications in action center.

Handling activation from a toast notification

Since Windows 8/8.1, applications has always been expected to handle activations in response to a user clicking on a toast notification from this app – the app should respond by performing navigation and displaying UI specific to the toast. This is accomplished through an activation string that you include in the toast payload, which is then passed to your app as an argument in the activation event.

In Windows 10, the data flow is very similar, but with the addition of adaptive templates and custom actions, there are 3 different kind of activations that the app might be expected to handle.

  1. Foreground activation from a toast notification using Windows 10 adaptive template;
  2. Background activation from a toast notification using Windows 10 adaptive template;
  3. Legacy: Foreground activation from a toast notification using legacy template.

Note: If you are developing a new Windows 10 universal app, I highly recommend using the new adaptive template. All legacy toast templates can be easily achieved by using the new adaptive template. By using the new adaptive template, you can have a consistent way and place to handle toast activation, which I will explain in details below.

1. Handling foreground activation from a toast notification using Windows 10 adaptive template

In Windows 10, we updated the toast activation behavior so that when a toast (or an action inside toast) triggers a foreground activation, OnActivated is invoked instead of OnLaunched, with a new activation kind – ToastNotification. Thus, the developer is able to easily distinguish a toast activation and perform tasks accordingly.

In the example you see below, you can retrieve the developer pre-defined arguments and the user generated input from the activation event.

protected override void OnActivated(IActivatedEventArgs e)
    // Get the root frame
    Frame rootFrame = Window.Current.Content as Frame;

    // TODO: Initialize root frame just like in OnLaunched

    // Handle toast activation
    if (e is ToastNotificationActivatedEventArgs)
        var toastActivationArgs = e as ToastNotificationActivatedEventArgs;
        // Parse the query string
        QueryString args = QueryString.Parse(toastActivationArgs.Argument);

        // See what action is being requested 
        switch (args["action"])
            // Open the image
            case "viewImage":

                // The URL retrieved from the toast args
                string imageUrl = args["imageUrl"];

                // If we're already viewing that image, do nothing
                if (rootFrame.Content is ImagePage && (rootFrame.Content as ImagePage).ImageUrl.Equals(imageUrl))

                // Otherwise navigate to view it
                rootFrame.Navigate(typeof(ImagePage), imageUrl);

            // Open the conversation
            case "viewConversation":

                // The conversation ID retrieved from the toast args
                int conversationId = int.Parse(args["conversationId"]);

                // If we're already viewing that conversation, do nothing
                if (rootFrame.Content is ConversationPage && (rootFrame.Content as ConversationPage).ConversationId == conversationId)

                // Otherwise navigate to view it
                rootFrame.Navigate(typeof(ConversationPage), conversationId);

        // If we're loading the app for the first time, place the main page on
        // the back stack so that user can go back after they've been
        // navigated to the specific page
        if (rootFrame.BackStack.Count == 0)
            rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null));

    // TODO: Handle other types of activation

    // Ensure the current window is active
protected override void OnActivated(IActivatedEventArgs args)
    // TODO: Initialize root frame just like in OnLaunched

    // Handle toast activation
    if (args.Kind == ActivationKind.ToastNotification)
        var toastArgs = args as ToastNotificationActivatedEventArgs;
        // Get arguments corresponding to this activation;
        // When tapping the body of the toast caused this activation, the app receives the value of “launch” property of ;
        // When the activation is caused by using tapping on an action inside the toast, the app receives the value of “arguments” property of ; 
        var arguments = toastArgs.Arguments;

        // User input from <input> can be retrieved using the UserInput property. The UserInput is a ValueSet and the key is the pre-defined id attribute in the <input> element in the payload.
        var input = toastArgs.UserInput["1"];

        // Navigate accordingly

    // TODO: Handle other types of activation

2. Handling background activation from a toast notification using Windows 10 adaptive template

When you specify the activation type of the toast notification (or an action inside the toast) to be background, a trigger will be fired to invoke the execution of your background task instead of activating your foreground app.

Please see this MSDN doc on how to register and create a background task as a Windows Runtime Component – Quickstart: Create and register a background task (XAML).

First, you need to declare your background task in your manifest by inserting the code below inside <Extensions>, which is a child element of <Application>…

  <Application ...>

          <Task Type="systemEvent" />



Then, you need to register a background task with the correct trigger. This is done programmatically. We recommend registering the background task in your app’s OnLaunched and/or OnActivated code.

BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();

BackgroundTaskBuilder builder = new BackgroundTaskBuilder()
    Name = "MyToastTask",
    TaskEntryPoint = "RuntimeComponent1.NotificationActionBackgroundTask"

builder.SetTrigger(new ToastNotificationActionTrigger());

BackgroundTaskRegistration registration = builder.Register();

When the task runs, your app is able to retrieve pre-defined arguments and user generated inputs from ToastNotificationActionTriggerDetail, very similar to how they are retrieved from the foreground activation EventArgs.

public sealed class NotificationActionBackgroundTask : IBackgroundTask
    public void Run(IBackgroundTaskInstance taskInstance)
        var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail;

        if (details != null)
            string arguments = details.Argument;
            var userInput = details.UserInput;

            // Perform tasks

3. Legacy: Handling foreground activation from a toast notification using legacy template

When the user taps on a toast constructed with one of the legacy templates, the associated app is launched or brought to the foreground, firing its OnLaunched method.

This example shows the syntax for the override of the OnLaunched event, in which you can retrieve and act on the Arguments provided by the LaunchActivatedEventArgs object (which comes from the toast’s launch attribute).

protected override void OnLaunched(LaunchActivatedEventArgs args)
    string launchString = args.Arguments


Keep toast and tile/badge in sync using ToastNotificationHistoryChangedTrigger

For a lot of apps, especially social networking or messaging apps, the toast notification is often corresponding to the badge/tile content – when a new toast notification is available and delivered, the app in this case would update the badge, to show the number of unseen toast notifications. When a toast notification is removed by the user, or expired by the system, the app is also expected to update the badge/tile to show the total number of toast notification left. This can now be done through a new trigger we introduce in Windows 10 – ToastNotificationHistoryChangedTrigger. As hinted by the name, this trigger is fired whenever the collection of toast notification history from your app changes on the device. Subscribing this trigger, will allow your app to get notified when:

  • A toast notification is removed by the user from action center;
  • A toast notification is expired and removed by the system from action center;
  • A toast notification is delivered form your app, via push;

Note: the only thing your app wouldn’t be notified for, is a local toast being popped/added, since it is not necessary to notify your app client about something it just did.

Here is how to register the background task in manifest by inserting below code inside <Extensions> which is a child element of <Application>:

<Extension Category="windows.backgroundTasks" EntryPoint="RuntimeComponent1.NotificationHistoryBackgroundTask">
    <Task Type="systemEvent" />

Please see this MSDN doc on how to register and create a background task as a Windows Runtime Component – Quickstart: Create and register a background task (XAML).

When the task runs, the app is able to retrieve information on whether toast was added or removed from the collection of existing toasts using TriggerDetails and do different things accordingly. In the sample below, you can see that we access ToastNotificationHistory to see how many toast notifications are there from my app in action center, then update the badge count with that number, when toast notifications are added or removed.

public sealed class NotificationHistoryBackgroundTask : IBackgroundTask
        public void Run(IBackgroundTaskInstance taskInstance)
            var details = taskInstance.TriggerDetails as ToastNotificationHistoryChangedTriggerDetail;
            if (details != null)
                switch (details.ChangeType)
                    case ToastHistoryChangedType.Added:
                    case ToastHistoryChangedType.Removed:
                //Do nothing;

        private void UpdateBadge()
            int badgeInt = ToastNotificationManager.History.GetHistory().Count;
            string badge = badgeInt.ToString();

            XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);

            XmlElement badgeElement = (XmlElement)badgeXml.SelectSingleNode("/badge");
            badgeElement.SetAttribute("value", badge);

            BadgeNotification badgeNotification = new BadgeNotification(badgeXml);


Comments (38)

  1. pkz says:

    I have a Windows 8.1 Universal app. I assume this will only work if the app is running on Windows 10. But will it cause issues if the app runs on Windows 8.1?

  2. leixu2046 says:

    @pkz Thanks for the question!

    If you are wondering if the new Windows 10 UWP app can run on Windows 8.1 platform, the answer is no unfortunately.

    If you are wondering if you can use the adaptive toast templates in a Windows 8.1 app running on Windows 10 OS, the answer is partially – you can use the adaptive templates (flexible visuals), but only part of the interactive features – you can do protocol launch, but not foreground activation or background activation since Windows 8.1 SDK doesn't have the new activation kind and the new background trigger.

  3. Suresh says:

    I have a windows 8 app, notifications enabled for my app. and its working great in windows 8 and windows 8.1 and Windows 10 machines.

    The only problem i am facing is when user taps on toast notification based on the launch arguments (which are present in toast can be read from LaunchActivatedEventArgs of Onlaunched event) I am redirecting the user to specific page. This functionality is working fine in Windows 8,8.1 machines but not working in windows 10 machine. Could you please suggest me what should i do ?

  4. andrewbares7 says:

    @Suresh – See our conversation on the Adaptive and Interactive Toasts documentation article

  5. Suresh says:

    @andrewbares7 – sorry for the late reply and thanks for pointing me. am going to see those comments now.

  6. Pawa says:

    Hi! You say "Note: the only thing your app wouldn’t be notified for, is a local toast being popped/added, since it is not necessary to notify your app client about something it just did.". That makes sense, but what about Scheduled Toast Notifications? Is there any way to be notified when a scheduled toast I issued fires?

  7. andrewbares7 says:

    @Pawa – even for scheduled toasts, that's something your local app knows about, so we choose not to tell you about something your app already knows about.

    What scenario are you trying to accomplish with this?

  8. Pawa says:

    @andrewbares7 – Thanks for your reply! I am doing it in foreground, but I couldn't find a way to do it in background. I have since solved my issue in another way, though.

    I'm developing an app for repetitive reminders, like "take a break every hour". I wanted to know in background when a notification is delivered so I could clear previous notifications and avoid a pile-up in the action bar.

    I have since discovered that by giving each notification the same Group and Tag effectively causes them to replace each other, which solves my issue. I can still compare them by storing unique Ids, so for my purpose everything is working.

  9. andrewbares7 says:

    @Pawa – Ah yes, Group and Tag sounds like the correct way to make that scenario work! Glad to hear you got it working!

    Note that you also can set the ExpirationTime on your toasts, so that they automatically disappear after a certain amount of time. Useful if a toast is no longer relevant after a certain point in time.

  10. ShenghuaChen says:

    Hello @leixu2046 and @andrewbares7. Can I send Toast Notifications from Win32 application? Since I didn't find any Win32 API for Toast Notifications, but I want to implement it with C++ in my Win32 application.Thank you.

  11. andrewbares7 says:

    @Shenghua – Lei is working on publishing a post explaining how to send toasts from Win32. He'll hopefully have that post up by the end of this week.

  12. leixu2046 says:

    @ShenghuaChen Hi Shenghua, check out this blog post on how win32 apps sends and handles toast notifications:


  13. ShenghuaChen says:

    Really thank you @andrewbares7 and @leixu2046, it's very helpful to me.

  14. heroichippo1 says:

    How can I launch this app from command line after its been built and deployed? Trying to create a batch file that can send a notification when my Unity build is finished, so all i need is a local notification, don't really care about all the different actions when using it, its just for my own personal use.

    All i can find online is using start.exe to launch settings programs etc, but nowhere do i see anything about how to launch a custom built app from start command.

  15. andrewbares7 says:

    @heroichippo1 – Sorry, our team isn't responsible for command line launching. We know nothing about that and can't help you. Try asking on MSDN forums.

  16. Chourouk says:

    These are 2 examples of samples using toast notifications and tile notifications:



    Best of luck!

  17. Rick says:

    Can’t clip this code or in some cases even read it. Is it formated for Edge?

    1. andrewbares7 says:

      Hey Rick, sorry for the issues with the code snippets. MSDN Blogs migrated to WordPress recently, and it seemed to have messed up a few things. I’ve fixed the code snippets, they should display and copy correctly now!

  18. Rocky says:

    Can background task works with Desktop application too? I am not planning to have my application available on app store or not creating a universal windows type of project. This is regular console or desktop application and will be closed after notification is generated, How can I implement chasing the actions?

  19. Ramkiran says:

    I have an Existing WinRT 8.1 App. All Toast Notifications works beautifully on Win8.1 OS.

    No when I tried to run the same 8.1 app on Win10 OS, I don’t see any notifications. Do I need to do something extra?

    Note: Action center is enabled and I have not restricted any App specific notifications in notification Center.

    1. andrewbares7 says:

      Hey Ramkiran, 8.1 apps should work fine on 10. Could you give us more info?
      (1) Desktop or Mobile?
      (2) What build are you running? Type “winver” in Start.
      (3) What’s your app’s name? Can we install it from the Store and try it out?
      (4) Are you using push notifications, or local notifications?
      (5) Which toast template are you using? ToastText01, etc…

      1. Ramkiran says:

        1. It is a Win8.1 Phone App running on Win10 OS Device.
        2. version is 1511 and Build is 10586.17.
        3. No you cannot download from Store.
        4. These are Local Notifications.
        5. ToastTemplateType.ToastText01

        More Information below – This doesn’t work with Assigned Access – Associate Persona. It works with Admin Persona.
        It has something to do with ToastCapable=”true” property in Manifest file. Below are my observations….
        1) First Time run ever with Toast Capable to true – No Toasts
        2) Seconds time run without Toast capability – Displayed Toasts.
        3) Third time run back with Toast Capable to true – Displayed Toasts.
        ->> Not sure why its behaving strange though.

        1. andrewbares7 says:

          Hmm, well you definitely need to have ToastCapable set to true in the manifest since 8.1 required that, otherwise your toasts won’t work in 8.1 (in 10, we stopped requiring the ToastCapable flag).

          I’ll see if I can repro the issue, but just FYI, we haven’t heard any other reports of toasts not working for 8.1 RT phone apps running on 10.

          1. Ramkiran says:

            I got it working with adding AUMID to the toast capable apps in Lockdown file.

  20. Hamza says:

    Hi everybody!
    Why there is no “ExpirationTime” attribute for the ScheduledToastNotification, In MSDN it says it has, in VS2015 Update 3 it says no. Can’t figure it out.

    1. andrewbares7 says:

      Hey Hamza, sorry for the extremely slow response. ScheduledToastNotification unfortunately is missing the ExpirationTime property as you noticed. Thank you for letting us know that you would use this property, that helps us prioritize for future releases!

      We’ve updated the MSDN documentation that incorrectly claimed ScheduledToastNotification supported expiration time. Thanks!

  21. Jay343 says:

    Is there a way to subscribe to all toast notifications? Specifically, if there is a commercial app running that pops toast for certain events, and I wish to write a service that waits for specific notifications from that app, which then performs a function based on the content of the notification, is that a supported scenario?

  22. lostmsu says:

    Is there a way to show Windows 8.x notifications on Windows 8.x, but show interactive ones on Windows 10? Currently, I am using custom template, and on Windows 8.x it does not show up at all. I want to be able to detect that and show Windows 8.x notification instead.

  23. Srinivasan says:

    Is there any way to notify my app for local toast?

  24. B G Turner says:

    I have a UWP app I am developing, I pop up toasts from a background task on a specified interval, this works perfectly.
    However when I click the toast my App loads up but never gets past the loading screen. I worked out that I need to handle the OnActivated override which I have done but if I breakpoint inside this event it is never triggered and my app never gets beyond the loading screen. Is there some reason this even would not trigger? The notification was created in c# using the community toolkit:

    1. leixu2046 says:

      Can you please share your Windows version information, and possibly a code snippet of how you construct your toast? Please feel free to reach out at lex@microsoft.com and we will be able to help further.

      1. B G Turner says:

        Hi, sorry this was me being a bit of an idiot, I finally realised what was going on after an hour or two of flapping.
        As I was opening the app from a Toast which was created in a background task the App was not actually being debugged in Visual Studio which obviously meant that the OnActivated break point as not being hit. So I went ahead and actually added the code and low and behold it worked.
        So mostly a schoolboy error! Out of interest, is there any way to attach a debugger to an App on launch like that? I have done it while a program is running but not automatically on launch. Its not something I have ever had to do before…

  25. Zal says:

    Not sure if anyone is reading this but I will ask anyway… is it possible to somehow inject into the system code for dismiss button or do I have to create a custom dismiss button if I want to do some things (like removing a line in a file) when the user clicks dismiss? Thanks.

    1. andrewbares7 says:

      Hey Zal!

      So you want a toast that, when the user clicks a button on your toast, your code modifies a file (removing a line in the file)? You would have to use a background activation button for that, which activates your background task to modify that file.

  26. Justin Hagerty says:

    I wanted to send a toast notification from a C# program with out using a UWP app. It took a lot of research. I am newish to C# and I have found a solution.


  27. Dev says:

    I just tried this API and it works very poorly. There’s bugs when I run this in embedded mode.

Skip to main content