1

I am trying to implement Toast Notifications in a winforms project using the ToastContentBuilder syntax, but when I set the toast notification group and attempt to read the group property later after retrieving it through ToastNotificationManagerCompat the group property is set to "ToolkitGroupNull" instead of the assigned value. All other properties on the notification are set properly.

This is how I'm scheduling my Toast Notifications and assigning to their group and tag.

new ToastContentBuilder()
   .Schedule(DateTime.Now.AddSeconds(10), toast =>
{
   toast.Tag = "tag";
   toast.Group = "group";
}

This is how I retrieve the scheduled notifications, where the Group property is set to "ToolkitGroupNull" instead of "group"

var toastNotifier = ToastNotificationManagerCompat.CreateToastNotifier();
var notifications = toastNotifier.GetScheduledToastNotifications();

foreach(var notification in notifications)
{
   Console.WriteLine(notification.Group);
}

Does anyone know why group isn't being set properly?

I was following the guide here Schedule a toast notification

I am using version 7.0 of Microsoft.Toolkit.Uwp.Notifications

Glissando
  • 13
  • 3
  • Random guess, but do you need to replace the ToastNotificationManagerCompat with DesktopNotificationManagerCompat? There's an important message at that link saying: `Desktop applications (both MSIX/sparse packages and classic desktop) have slightly different steps for sending notifications and handling activation. Follow along with the instructions below, however replace ToastNotificationManager with the DesktopNotificationManagerCompat class from the desktop apps documentation.` – ourmandave Jul 16 '21 at 02:08
  • see https://stackoverflow.com/questions/66694454/how-can-i-make-a-notification-in-a-c-sharp-windows-app-with-a-custom-image-and-o – Meysam Asadi Jul 16 '21 at 17:42

0 Answers0