AppointmentViewInfo.CustomViewInfo Property
Gets or sets a custom object to be used for rendering the appointment.
Namespace: DevExpress.Xpf.Scheduler.Drawing
Assembly: DevExpress.Xpf.Scheduler.v14.2.dll
#Declaration
#Property Value
Type | Description |
---|---|
Object | An object used for customizing the appointment's visual representation. |
#Remarks
Use the CustomViewInfo property to specify a custom object (for example, resource image) to be displayed within an appointment.
#Examples
TIP
A complete sample project is available in the DevExpress Code Examples database at http://www.
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];
}
}
}
}