Back to Devexpress

SchedulerControl.AppointmentFlyoutShowing Event

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

latest6.5 KB
Original Source

SchedulerControl.AppointmentFlyoutShowing Event

Occurs before the appointment flyout is shown and allows you to substitute a flyout with another control.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event AppointmentFlyoutShowingEventHandler AppointmentFlyoutShowing
vb
Public Event AppointmentFlyoutShowing As AppointmentFlyoutShowingEventHandler

Event Data

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

PropertyDescription
CancelGets or sets whether the appointment flyout is not shown.
ControlAllows you to set a control to display instead of default appointment flyout content.
FlyoutDataProvides access to data displayed in the appointment flyout.
HtmlTemplateSpecifies an HTML-CSS template for an appointment flyout.

Remarks

The event arguments’ AppointmentFlyoutShowingEventArgs.FlyoutData property contains data for display in a flyout or using a custom control.

To add interactive elements into a Flyout panel (buttons, editors, etc.), either assign custom Flyout forms to the e.Control property or cancel the default Flyout and show a custom panel instead.

csharp
FlyoutPanel flyoutPanel = new FlyoutPanel();
XtraUserControl1 uc = new XtraUserControl1 { Dock = DockStyle.Fill };
//...
flyoutPanel.OwnerControl = schedulerControl1;
flyoutPanel.Size = uc.Size;
uc.Parent = flyoutPanel;
schedulerControl1.AppointmentFlyoutShowing += SchedulerControl_AppointmentFlyoutShowing;
//...
void SchedulerControl_AppointmentFlyoutShowing(object sender, AppointmentFlyoutShowingEventArgs e) {
    e.Cancel = true;
    flyoutPanel.ShowBeakForm(Cursor.Position);
}
vb
Dim flyoutPanel As New FlyoutPanel()
Dim uc As XtraUserControl1 = New XtraUserControl1 With {.Dock = DockStyle.Fill}
'...
flyoutPanel.OwnerControl = schedulerControl1
flyoutPanel.Size = uc.Size
uc.Parent = flyoutPanel
schedulerControl1.AppointmentFlyoutShowing += SchedulerControl_AppointmentFlyoutShowing
'...
Private Sub SchedulerControl_AppointmentFlyoutShowing(ByVal sender As Object, ByVal e As AppointmentFlyoutShowingEventArgs)
    e.Cancel = True
    flyoutPanel.ShowBeakForm(Cursor.Position)
End Sub

Example

This code snippet substitutes an appointment flyout with a custom label control, as illustrated below:

csharp
scheduler.AppointmentFlyoutShowing += scheduler_AppointmentFlyoutShowing;

System.Windows.Forms.Label myControl;
Font myFont = new Font("Arial", 20);
public void scheduler_AppointmentFlyoutShowing(object sender, AppointmentFlyoutShowingEventArgs e) {
    if(myControl == null) {
        myControl = new System.Windows.Forms.Label();
        myControl.BackColor = Color.LightGreen;
        myControl.Size = new Size(200, 100);
        myControl.Font = myFont;
    }
    myControl.Text = e.FlyoutData.Subject;
    e.Control = myControl;
}
vb
AddHandler scheduler.AppointmentFlyoutShowing, AddressOf scheduler_AppointmentFlyoutShowing

Private myControl As System.Windows.Forms.Label
Private myFont As New Font("Arial", 20)

Public Sub scheduler_AppointmentFlyoutShowing(ByVal sender As Object, ByVal e As AppointmentFlyoutShowingEventArgs)
    If myControl Is Nothing Then
        myControl = New System.Windows.Forms.Label()
        myControl.BackColor = Color.LightGreen
        myControl.Size = New Size(200, 100)
        myControl.Font = myFont
    End If
    myControl.Text = e.FlyoutData.Subject
    e.Control = myControl
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AppointmentFlyoutShowing 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#L117

csharp
if (chkBtnAppointmentFlyoutShowing.Checked)
schedulerControl1.AppointmentFlyoutShowing += OnSchedulerControl1AppointmentFlyoutShowing;
else

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

vb
If chkBtnAppointmentFlyoutShowing.Checked Then
    AddHandler schedulerControl1.AppointmentFlyoutShowing, AddressOf OnSchedulerControl1AppointmentFlyoutShowing
Else

See Also

SchedulerControl Class

SchedulerControl Members

DevExpress.XtraScheduler Namespace