Click here to Skip to main content
16,018,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

i use ToastNotifications in my C# Application.
Using the Microsoft.Toolkit.Uwp.Notifications NuGet Package.
Content is build with ToastContentBuilder.

I added the ToastNotificationManagerCompat.OnActivated event in my Application_Startup Method.
ToastNotificationManagerCompat.OnActivated += toastArgs =>

In the ToastContentBuilder i use e.g.
C#
.AddArgument("action", "startNow")
.SetBackgroundActivation())

for ToastButtons to be able to react to a specific button click.
Everything works fine.

The only action which does not trigger this event is when i click exactly on the "x" Symbol right behind the application name to close the Notification.

Clicking the buttons trigger this event, clicking anywhere in the ToastNotification triggers the event.

Only whe i click right on the "x", i do cannot reach this event.

Do you have an idea how i can react on clicking "x" ?

Thank you and best regards
Emanuel

What I have tried:

I set the
C#
.SetBackgroundActivation()

method for my ToastContentBuilder instance
and additionally for the ToastButton variables.
Posted
Updated 15-Feb-24 5:23am
Comments
Richard Deeming 16-Feb-24 3:48am    
You almost certainly can't intercept or alter the behaviour when the user clicks the "x" button to close your notification.

If you could, then imagine the havoc a rogue app developer could wreak, creating an unclosable "your PC is infected, call xxx-xxxx-xxxx NOW to fix!" notification.

1 solution

Thank you - very good thoughts...
You're completely right, it seems that it works like it should - it really would be a security issue if the behaviour clicking on "x" could be modified...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900