Skip to main content

SchedulerControl.AppointmentViewInfoCustomizing Event

Allows customizing the appointment's appearance by modifying the style elements when it is painted.

Namespace: DevExpress.Xpf.Scheduler

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

Declaration

public event AppointmentViewInfoCustomizingEventHandler AppointmentViewInfoCustomizing
Public Event AppointmentViewInfoCustomizing As AppointmentViewInfoCustomizingEventHandler

Event Data

The AppointmentViewInfoCustomizing event's handler receives an argument of the AppointmentViewInfoCustomizingEventArgs type. The following properties provide information specific to this event:

Property Description
ViewInfo Gets the object which contains information used to render the appointment.

Remarks

If you need to implement conditional styling based on the appointment data, handle the AppointmentViewInfoCustomizing event, and modify any appearance property using the appointment's data as a condition.

Examples

TIP

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

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;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Windows.Media.Imaging;
using DevExpress.XtraScheduler;
using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.Drawing;

namespace SilverlightApplication1 {
    public partial class MainPage : UserControl {
        Dictionary<Resource, BitmapImage> resourceImages = new Dictionary<Resource, BitmapImage>();

        public MainPage() {
            InitializeComponent();

            // ...

            DataTemplate template = (DataTemplate)this.Resources["AppointmentTooltipContentTemplate"];
            schedulerControl1.WeekView.AppointmentToolTipContentTemplate = template;
        }

        private void schedulerControl1_AppointmentViewInfoCustomizing(object sender, 
                                                        AppointmentViewInfoCustomizingEventArgs e) {
            AppointmentViewInfo viewInfo = e.ViewInfo;
            Resource resource = schedulerControl1.Storage.ResourceStorage.
                                GetResourceById(viewInfo.Appointment.ResourceId);
            if (resource == Resource.Empty || resource.Image == null)
                viewInfo.CustomViewInfo = null;
            else {
                if (!this.resourceImages.ContainsKey(resource))
                    this.resourceImages[resource] = resource.Image.Source as BitmapImage;
                viewInfo.CustomViewInfo = this.resourceImages[resource];
            }
        }
    }
}
See Also