Back to Devexpress

SchedulerControl.AppointmentViewInfoCustomizing Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-a83a9963.md

latest5.2 KB
Original Source

SchedulerControl.AppointmentViewInfoCustomizing Event

Use this event to customize the appointment’s appearance by modifying the style elements when it is painted. If the multi-threading is on, this event does not raise in the UI thread.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event AppointmentViewInfoCustomizingEventHandler AppointmentViewInfoCustomizing
vb
Public Event AppointmentViewInfoCustomizing As AppointmentViewInfoCustomizingEventHandler

Event Data

The AppointmentViewInfoCustomizing event's data class is AppointmentViewInfoCustomizingEventArgs. The following properties provide information specific to this event:

PropertyDescription
ViewInfoProvides access to the object which contains the information used to render the appointment.

Remarks

To implement conditional styling based on the appointment data, handle the AppointmentViewInfoCustomizing event use the appointment’s data as a condition to modify appearance properties. The following code snippet makes the same text bold in every appointment’s subject.

csharp
Font myFont = new Font("Segoe UI",8.25F, FontStyle.Bold);
//. . .
private void schedulerControl1_AppointmentViewInfoCustomizing(object sender, 
    DevExpress.XtraScheduler.AppointmentViewInfoCustomizingEventArgs e)
{
    if (e.ViewInfo.Appointment.Subject.Contains("vacation"))
        e.ViewInfo.Appearance.Font = myFont;
        //or
        //e.ViewInfo.Appearance.FontStyleDelta = Bold;
}
vb
Dim myFont As New Font("Segoe UI",8.25F, FontStyle.Bold)
'. . .
Private Sub schedulerControl1_AppointmentViewInfoCustomizing(ByVal sender As Object, ByVal e As DevExpress.XtraScheduler.AppointmentViewInfoCustomizingEventArgs)
    If e.ViewInfo.Appointment.Subject.Contains("vacation") Then
        e.ViewInfo.Appearance.Font = myFont
    End If
        'or
        'e.ViewInfo.Appearance.FontStyleDelta = Bold;
End Sub

Important

Do not modify appointment properties, and do not add or remove appointments within this event handler. An attempt to do so may result in an unhandled exception. Also, if the UseAsyncMode property is enabled, the AppointmentViewInfoCustomizing event raises in the non-UI thread. In this case, performing non-thread-safe operations may cause a deadlock.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AppointmentViewInfoCustomizing event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-create-appointments-on-reminder-alert/CS/ReminderCustomActions/Form1.cs#L18

csharp
// Subscribe to hide reminder icons for occurrences in the past.
schedulerControl1.AppointmentViewInfoCustomizing += SchedulerControl1_AppointmentViewInfoCustomizing;
// Subscribe to update appointment info displayed in the text box on the main form.

winforms-scheduler-create-appointments-on-reminder-alert/VB/ReminderCustomActions/Form1.vb#L20

vb
' Subscribe to hide reminder icons for occurrences in the past.
AddHandler schedulerControl1.AppointmentViewInfoCustomizing, AddressOf SchedulerControl1_AppointmentViewInfoCustomizing
' Subscribe to update appointment info displayed in the text box on the main form.

See Also

LayoutViewInfoCustomizing

How to: Custom Paint Appointments

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace