Category / Section
How to notify when an appointment reminder action changed in the WPF Scheduler (Calendar)
2 mins read
WPF Scheduler supports to notify the appointment reminders action such as dismiss, dismiss all, or snooze changed in the scheduler built-in reminder alert window.
STEP 1: To alert the appointment reminders in the scheduler, enable the reminder for the scheduler using the EnableReminder property.
<schedule:SfScheduler x:Name="schedule" EnableReminder="True"/>
STEP 2: Add the reminders for an appointment using the ScheduleReminder, and the scheduler reminder alert window will be open on the appointment reminders time.
private void AddAppointments() { this.Appointments = new ScheduleAppointmentCollection(); var newEvent = new ScheduleAppointment(); newEvent.Subject = "Meeting"; newEvent.StartTime = new DateTime(2021, 06, 16, 10, 0, 0); newEvent.EndTime = new DateTime(2021, 06, 16, 11, 0, 0); newEvent.AppointmentBackground = Brushes.Green; newEvent.Reminders = new ObservableCollection<SchedulerReminder> { new SchedulerReminder { ReminderTimeInterval = new TimeSpan(0)}, }; var newEvent1 = new ScheduleAppointment(); newEvent1.Subject = "Planning"; newEvent1.StartTime = new DateTime(2021, 06, 16, 12, 0, 0); newEvent1.EndTime = new DateTime(2021, 06, 16, 13, 0, 0); newEvent1.AppointmentBackground = Brushes.Green; newEvent1.Reminders = new ObservableCollection<SchedulerReminder> { new SchedulerReminder { ReminderTimeInterval = new TimeSpan(0)}, }; var newEvent2 = new ScheduleAppointment(); newEvent2.Subject = "Retrospective"; newEvent2.StartTime = new DateTime(2021, 06, 16, 14, 0, 0); newEvent2.EndTime = new DateTime(2021, 06, 16, 15, 0, 0); newEvent2.AppointmentBackground = Brushes.Green; newEvent2.Reminders = new ObservableCollection<SchedulerReminder> { new SchedulerReminder { ReminderTimeInterval = new TimeSpan(0)}, }; this.Appointments.Add(newEvent); this.Appointments.Add(newEvent1); this.Appointments.Add(newEvent2); }
XAML
<Window.DataContext> <local:SchedulerViewModel/> </Window.DataContext> <schedule:SfScheduler x:Name="schedule" EnableReminder="True" ItemsSource="{Binding Appointments}"/>
STEP 3: ReminderAlertActionChanged event will be triggered while changing the alert actions such as Dismiss, Dismiss All, Snooze in the scheduler built-in reminder alert window.
Schedule.ReminderAlertActionChanged += OnScheduleReminderAlertActionChanged; private void OnScheduleReminderAlertActionChanged (object sender, ReminderAlertActionChangedEventArgs e) { if (e.ReminderAction == ReminderAction.Dismiss) { MessageBox.Show("Reminder alert action Dismiss clicked for appointment", "Reminder", MessageBoxButton.OK); } else if (e.ReminderAction == ReminderAction.DismissAll) { MessageBox.Show("Reminder alert action cancelled for all appointments", "Reminder", MessageBoxButton.OK); } else if (e.ReminderAction == ReminderAction.Snooze) { MessageBox.Show("Reminder alert action Snoozed", "Reminder", MessageBoxButton.OK); } }