windowsforms-2283-controls-and-libraries-scheduler-examples-appearance-how-to-display-custom-tooltips-for-appointments.md
Important
To display tooltips, hide appointment flyouts using the SchedulerOptionsCustomization.AllowDisplayAppointmentFlyout property:
schedulerControl1.OptionsCustomization.AllowDisplayAppointmentFlyout = false;
schedulerControl1.OptionsCustomization.AllowDisplayAppointmentFlyout = False
By default the appointment tooltip contains the text obtained from the Appointment.Subject property. Appointments with empty subjects do not display a tooltip at all.
To display a tooltip for an appointment with empty subject, handle the SchedulerControl.AppointmentViewInfoCustomizing event and assign the tooltip text to the e.ViewInfo.ToolTipText property.
private void SchedulerControl1_AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e) {
if (e.ViewInfo.DisplayText == String.Empty)
e.ViewInfo.ToolTipText = String.Format("Started at {0:g}", e.ViewInfo.Appointment.Start);
}
Private Sub SchedulerControl1_AppointmentViewInfoCustomizing(ByVal sender As Object, ByVal e As AppointmentViewInfoCustomizingEventArgs)
If e.ViewInfo.DisplayText = String.Empty Then
e.ViewInfo.ToolTipText = String.Format("Started at {0:g}", e.ViewInfo.Appointment.Start)
End If
End Sub
The following example demonstrates how to control the tooltip appearance and a tooltip message which is displayed for each appointment.
Drop a ToolTipController component from Toolbox onto a form, assign it to the SchedulerControl.ToolTipController property, and adjust tooltip controller settings as your need dictates. You can also handle the ToolTipController.BeforeShow event to specify tooltip text and appearance.
The code below demonstrates the ToolTipController.BeforeShow event handler.
Font font14 = new Font("Times New Roman", 14);
Font font8 = new Font("Comic Sans MS", 8);
private void toolTipController1_BeforeShow(object sender, ToolTipControllerShowEventArgs e) {
ToolTipController controller = sender as ToolTipController;
AppointmentViewInfo aptViewInfo = controller.ActiveObject as AppointmentViewInfo;
if (aptViewInfo == null) return;
if (toolTipController1.ToolTipType == ToolTipType.Standard) {
e.IconType = ToolTipIconType.Information;
e.ToolTip = aptViewInfo.Description;
}
if (toolTipController1.ToolTipType == ToolTipType.SuperTip) {
SuperToolTip SuperTip = new SuperToolTip();
SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
args.Title.Text = "Info";
args.Title.Font = font14;
args.Contents.Text = aptViewInfo.Description;
args.Contents.Image = resImage;
args.ShowFooterSeparator = true;
args.Footer.Font = font8;
args.Footer.Text = "SuperTip";
SuperTip.Setup(args);
e.SuperTip = SuperTip;
}
}
Dim font14 As New Font("Times New Roman", 14)
Dim font8 As New Font("Comic Sans MS", 8)
Private Sub toolTipController1_BeforeShow(ByVal sender As Object, ByVal e As ToolTipControllerShowEventArgs)
Dim controller As ToolTipController = TryCast(sender, ToolTipController)
Dim aptViewInfo As AppointmentViewInfo = TryCast(controller.ActiveObject, AppointmentViewInfo)
If aptViewInfo Is Nothing Then
Return
End If
If toolTipController1.ToolTipType = ToolTipType.Standard Then
e.IconType = ToolTipIconType.Information
e.ToolTip = aptViewInfo.Description
End If
If toolTipController1.ToolTipType = ToolTipType.SuperTip Then
Dim SuperTip As New SuperToolTip()
Dim args As New SuperToolTipSetupArgs()
args.Title.Text = "Info"
args.Title.Font = font14
args.Contents.Text = aptViewInfo.Description
args.Contents.Image = resImage
args.ShowFooterSeparator = True
args.Footer.Font = font8
args.Footer.Text = "SuperTip"
SuperTip.Setup(args)
e.SuperTip = SuperTip
End If
End Sub