windowsforms-4006-controls-and-libraries-scheduler-examples-reminders-how-to-hide-the-reminder-bell-icon-for-outdated-appointments-in-a-series.md
The following example demonstrates how to hide the reminder icon for past appointments in a series. Since they are outdated, the user should not be reminded of them, and displaying the bell icon has no sense.
To achieve this, the SchedulerControl.AppointmentViewInfoCustomizing event is handled. The RecurringReminder.AlertOccurrenceIndex property is used to indicate the first appointment in a chain for which an alert will be invoked. All occurrences with Appointment.RecurrenceIndex less than the AlertOccurrenceIndex are outdated.
void scheduler_AppointmentViewInfoCustomizing(object sender,
AppointmentViewInfoCustomizingEventArgs e)
{
Appointment apt = e.ViewInfo.Appointment;
if (apt.HasReminder && apt.Type == AppointmentType.Occurrence &&
apt.RecurrencePattern != null)
{
Appointment pattern = apt.RecurrencePattern;
RecurringReminder reminder = (RecurringReminder)pattern.Reminder;
e.ViewInfo.ShowBell = reminder.AlertOccurrenceIndex < = apt.RecurrenceIndex;
}
}
Private Sub scheduler_AppointmentViewInfoCustomizing(ByVal sender As Object, ByVal e As _
AppointmentViewInfoCustomizingEventArgs) _
Handles schedulerControl1.AppointmentViewInfoCustomizing
Dim apt As Appointment = e.ViewInfo.Appointment
If apt.HasReminder AndAlso apt.Type = AppointmentType.Occurrence AndAlso Not _
apt.RecurrencePattern Is Nothing Then
Dim pattern As Appointment = apt.RecurrencePattern
Dim reminder As RecurringReminder = CType(pattern.Reminder, RecurringReminder)
e.ViewInfo.ShowBell = reminder.AlertOccurrenceIndex < = apt.RecurrenceIndex
End If
End Sub
See Also
AppointmentViewInfoCustomizing
CustomDrawAppointmentBackground
How to: Display Custom Images for Appointments
How to: Custom Paint Appointments