question

MangoApps-1236 avatar image
0 Votes"
MangoApps-1236 asked ·

Show notification banner only..

I want to show notification banner only and don't want to add my notification in action center.. for some notifications.

Is there any API where I can decide this to add in the action center or not

windows-uwp
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, Sorry to bother you, did you solve this problem, and is there anything else I can help you with?

0 Votes 0 ·

Hello, does my answer solve your problem? If you have new questions, please feel free to ask us

0 Votes 0 ·
RichardZhang-MSFT avatar image
1 Vote"
RichardZhang-MSFT answered ·

Hello,​

Welcome to our Microsoft Q&A platform!

In UWP, Toast Notification is sent via ToastNotifier, which will inevitably leave a record in the action center.

But you can try to remove history after notification:

 private async void SendNotificationWithoutHistory(ToastNotification toast)
 {
     toast.Tag = "testTag";
     var notifier = ToastNotificationManager.CreateToastNotifier();
     notifier.Show(toast);
     await Task.Delay(3000);
     ToastNotificationManager.History.Remove("testTag");
 }

In this code, we first display a notification and then remove it from the action center after 3 seconds.

But currently, there is no API that can only show notifications without keeping records.

Thanks

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

macintoshpro avatar image
0 Votes"
macintoshpro answered ·

You can try InAppNotification from Windows Community Toolkit (https://github.com/windows-toolkit/WindowsCommunityToolkit). It provide notification within app, easier to call

 // Show notification with simple text (and a duration of 2 seconds)
 int duration = 2000;
 ExampleInAppNotification.Show("Some text.", duration);


·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.