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

How to: Apply a Custom Template to Vertical Appointments in the Day or Work-Week View (legacy)

  • 2 minutes to read

Note

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.

This example demonstrates how to use the DayView.VerticalAppointmentContentTemplate property to apply a custom template to appointments displayed vertically in the Day View and Work-Week View.

using System;
using System.Windows;
using DevExpress.Xpf.Scheduler;
using DevExpress.XtraScheduler;

namespace WpfApplication1 {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();

            SchedulerStorage schedulerStorage = schedulerControl1.Storage;
            Appointment apt = schedulerStorage.CreateAppointment(AppointmentType.Normal);
            DateTime baseTime = DateTime.Today;

            apt.Start = baseTime.AddHours(1);
            apt.End = baseTime.AddHours(3.5);
            apt.Subject = "Appointment Subject";
            apt.Location = "Appointment Location";
            apt.Description = "Appointment description";

            schedulerStorage.AppointmentStorage.Add(apt);

            schedulerControl1.Start = apt.Start.Date;
            schedulerControl1.ActiveView.SelectAppointment(apt);
        }
    }
}

The image below shows the result.

DXScheduler_CustomVerticalAppointments