Back to Devexpress

How to: Hide the Reminder (Bell) Icon for Outdated Appointments in a Series

windowsforms-4006-controls-and-libraries-scheduler-examples-reminders-how-to-hide-the-reminder-bell-icon-for-outdated-appointments-in-a-series.md

latest3.1 KB
Original Source

How to: Hide the Reminder (Bell) Icon for Outdated Appointments in a Series

  • Dec 15, 2019
  • 2 minutes to read

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.

csharp
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;
    }
}
vb
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

CustomDrawAppointment

CustomDrawAppointmentBackground

DrawDefault()

How to: Display Custom Images for Appointments

How to: Custom Paint Appointments

How to: Custom Paint Day Headers

How to: Hide Grid Lines in the View