How to: Display Custom Tooltips for Appointments

  • 2 minutes to read
IMPORTANT

To display tooltips, hide appointment flyouts using the SchedulerOptionsCustomization.AllowDisplayAppointmentFlyout property:


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);
}

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.

tooltip

The code below demonstrates the ToolTipController.BeforeShow event handler.

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 = new Font("Times New Roman", 14);
        args.Contents.Text = aptViewInfo.Description;
        args.Contents.Image = resImage;
        args.ShowFooterSeparator = true;
        args.Footer.Font = new Font("Comic Sans MS", 8);
        args.Footer.Text = "SuperTip";
        SuperTip.Setup(args);
        e.SuperTip = SuperTip;
    }
}