Skip to main content
A newer version of this page is available. .

SchedulerViewBase.AppointmentToolTipContentTemplate Property

Gets or sets the template that defines the visual content of tooltips shown for appointments.

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v18.2.dll

Declaration

public DataTemplate AppointmentToolTipContentTemplate { get; set; }

Property Value

Type Description
DataTemplate

A DataTemplate object that defines the content of appointment tooltips.

Remarks

Important

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

The templates supplied by the DXScheduler allow you to completely replace the look and feel of visual elements, while maintaining their existing behavior.

The binding source for the AppointmentToolTipContentTemplate template is represented by the DevExpress.Xpf.Scheduler.Drawing.VisualAppointmentViewInfo class.

To learn more, see Styles and Templates.

Example

Tip

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2999.

This example demonstrates how to use the AppointmentViewInfo.Subject, AppointmentViewInfo.Location, AppointmentViewInfo.Description, AppointmentViewInfo.CustomViewInfo, SchedulerViewBase.AppointmentToolTipContentTemplate properties and SchedulerControl.AppointmentViewInfoCustomizing event to define and apply a custom template for showing an appointment subject, location, description and resource images within appointment tooltips.

using System.IO;
using System.Data;
using System.Windows;
using System.Data.OleDb;
using DevExpress.Xpf.Core.Native;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using DevExpress.XtraScheduler;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Drawing;

namespace WpfApplication1 {
public partial class MainWindow : Window {
    Dictionary<Resource, BitmapImage> resourceImages = new Dictionary<Resource, BitmapImage>();

    public MainWindow() {
        InitializeComponent();

        // ...

        DataTemplate template = (DataTemplate)this.FindResource("AppointmentTooltipContentTemplate");
        schedulerControl1.WorkWeekView.AppointmentToolTipContentTemplate = template;

    }

    private void schedulerControl1_AppointmentViewInfoCustomizing(object sender, 
                                                                AppointmentViewInfoCustomizingEventArgs e) {
    AppointmentViewInfo viewInfo = e.ViewInfo;
    Resource resource = schedulerControl1.Storage.Resources.GetResourceById(viewInfo.Appointment.ResourceId);
    if (resource == Resource.Empty || resource.Image == null)
        viewInfo.CustomViewInfo = null;
    else {
        if (!this.resourceImages.ContainsKey(resource))
        this.resourceImages[resource] = ImageHelper.CreateImageFromStream(ConvertImageToMemoryStream(resource.Image));

        viewInfo.CustomViewInfo = this.resourceImages[resource];
    }
    }

    public static MemoryStream ConvertImageToMemoryStream(System.Drawing.Image img) {
        var ms = new MemoryStream();
        img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        return ms;
    }

}
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the AppointmentToolTipContentTemplate property.

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.

See Also