Back to Devexpress

SchedulerControl.CustomizeAppointmentFlyout Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-75ea2320.md

latest9.0 KB
Original Source

SchedulerControl.CustomizeAppointmentFlyout Event

Occurs before displaying an appointment flyout and allows you to change the displayed text, background and the subject’s font. Precedes the SchedulerControl.CustomDrawAppointmentFlyoutSubject event.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event CustomizeAppointmentFlyoutEventHandler CustomizeAppointmentFlyout
vb
Public Event CustomizeAppointmentFlyout As CustomizeAppointmentFlyoutEventHandler

Event Data

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

PropertyDescription
AppearanceProvides access to an object used to control the appearance of the flyout contents, except the Subject rectangle.
AppointmentProvides access to an appointment for which the flyout is invoked.
EndGets or sets the DateTime value displayed after the End text label.
LocationGets or sets the text displayed after the Location text label.
ReminderGets or sets a reminder whose information is displayed in the appointment flyout.
ShowEndDateGets or sets whether to display the End information.
ShowLocationGets or sets whether to display the Location information.
ShowReminderGets or sets whether to display the time before start information of the appointment reminder.
ShowStartDateGets or sets whether to display the Start information.
ShowStatusGets or sets whether to display the status line.
ShowSubjectGets or sets whether to display the Subject rectangle.
StartGets or sets the DateTime value displayed after the Start text label.
SubjectGets or sets the text displayed in the Subject rectangle.
SubjectAppearanceProvides access to an object used to specify the appearance of the text in the Subject rectangle of the appointment flyout.

Remarks

By handling the CustomizeAppointmentFlyout event, you can change the text displayed in the flyout, specify the background color and the font used to display the information. You can also specify whether to display the status line in the Subject rectangle and whether to show the Subject rectangle itself.

If the SchedulerOptionsCustomization.AllowDisplayAppointmentFlyout property is false , this event does not occur.

Example

This example handles the SchedulerControl.CustomizeAppointmentFlyout event to customize the Appointment Flyout element. The SchedulerControl.CustomDrawAppointmentFlyoutSubject event is handled to perform custom drawing in the flyout’s subject region.

csharp
scheduler.ActiveViewType = SchedulerViewType.FullWeek;
    scheduler.CustomizeAppointmentFlyout += scheduler_CustomizeAppointmentFlyout;
    scheduler.CustomDrawAppointmentFlyoutSubject+= scheduler_CustomDrawAppointmentFlyoutSubject;
static Font fnt = new Font("Segoe UI", 10f);
public static void scheduler_CustomizeAppointmentFlyout(object sender, CustomizeAppointmentFlyoutEventArgs e) {
    e.ShowSubject = true;
    e.Subject = String.Format("{0} - {1:f}", e.Subject.Split()[0], e.Start);
    e.SubjectAppearance.Font = fnt;
    e.ShowReminder = false;
    e.ShowLocation = false;
    e.ShowEndDate = false;
    e.ShowStartDate = false;
    e.ShowStatus = true;
    e.Appearance.BackColor = Color.Gray;
}
static Font fnt1 = new Font("Verdana", 12f);
public static void scheduler_CustomDrawAppointmentFlyoutSubject(object sender, CustomDrawAppointmentFlyoutSubjectEventArgs e) {
    e.Cache.FillRectangle(Brushes.White, e.Bounds);
    e.DrawStatusDefault();
    e.Cache.DrawString("Please note", fnt1, Brushes.Blue, 
        new Rectangle(e.Bounds.X + 50, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height),
        StringFormat.GenericTypographic);
    e.Handled = true;
}
vb
scheduler.ActiveViewType = SchedulerViewType.FullWeek
    AddHandler scheduler.CustomizeAppointmentFlyout, AddressOf scheduler_CustomizeAppointmentFlyout
    AddHandler scheduler.CustomDrawAppointmentFlyoutSubject, AddressOf scheduler_CustomDrawAppointmentFlyoutSubject
Shared fnt As Font = New Font("Segoe UI", 10.0F)
Public Shared Sub scheduler_CustomizeAppointmentFlyout(ByVal sender As Object, ByVal e As CustomizeAppointmentFlyoutEventArgs)
    e.ShowSubject = True
    e.Subject = String.Format("{0} - {1:f}", e.Subject.Split()(0), e.Start)
    e.SubjectAppearance.Font = fnt
    e.ShowReminder = False
    e.ShowLocation = False
    e.ShowEndDate = False
    e.ShowStartDate = False
    e.ShowStatus = True
    e.Appearance.BackColor = Color.Gray
End Sub
Shared fnt1 As Font = New Font("Verdana", 12.0F)
Public Shared Sub scheduler_CustomDrawAppointmentFlyoutSubject(ByVal sender As Object, ByVal e As CustomDrawAppointmentFlyoutSubjectEventArgs)
    e.Cache.FillRectangle(Brushes.White, e.Bounds)
    e.DrawStatusDefault()
    e.Cache.DrawString("Please note", fnt1, Brushes.Blue, New Rectangle(e.Bounds.X + 50, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), StringFormat.GenericTypographic)
    e.Handled = True
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomizeAppointmentFlyout 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-customize-appointment-flyout/CS/CustomAppointmentFlyoutExample/Form1.cs#L125

csharp
if (chkBtnCustomizeAppointmentFlyout.Checked)
    schedulerControl1.CustomizeAppointmentFlyout += OnSchedulerControlCustomizeAppointmentFlyout;
else

winforms-scheduler-customize-appointment-flyout/VB/CustomAppointmentFlyoutExample/Form1.vb#L135

vb
If chkBtnCustomizeAppointmentFlyout.Checked Then
    AddHandler schedulerControl1.CustomizeAppointmentFlyout, AddressOf OnSchedulerControlCustomizeAppointmentFlyout
Else

See Also

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace