[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Collapse]Scheduler (legacy)
   [Collapse]Getting Started
     Lesson 1 - Create an Application using the Template Gallery or Instant Layout Assistant (legacy)
     Lesson 2 - Provide Bar UI for a Scheduler (legacy)
     Lesson 3 - Provide Ribbon UI for a Scheduler (legacy)
     Lesson 4 - Use the DateNavigator Control (legacy)
     Lesson 5 - Bind a Scheduler to Entity Framework Data Source (legacy)
     Lesson 6 - Bind a Scheduler to MS SQL Server Database (legacy)
     Lesson 7 - Create a Custom Edit Appointment Form Using the MVVM Pattern (legacy)
     Lesson 8 - Create a Custom Appointment Recurrence Dialog Using the MVVM Pattern (legacy)
     Lesson 9 - Create a Custom Edit Appointment Form (legacy)
   [Expand]Visual Elements
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Lesson 9 - Create a Custom Edit Appointment Form (legacy)


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 document describes how to substitute a standard Edit Appointment form with a custom form. This is useful when you bind a scheduler control to data with custom fields, and wish to provide end users with the capability to edit these fields in a custom Edit Appointment form. To simplify this example, disable the Appointment Recurrence feature, and prevent end users from working with recurring appointments using the Appointment Recurrence dialog.

This lesson consists of the following sections.

Expanded Specify Custom Field Mappings

  1. Open the WPF application with the SchedulerControl, which was created in Lesson 6 - Bind a Scheduler to MS SQL Server Database (legacy) of the current tutorial.
  2. Add a custom field mapping for the non-standard appointment field that has the "CustomField1" name in the datasource. To do this, configure the Storage.AppointmentStorage.CustomFieldMappings property. Click the Edit Items in This Collection button to invoke the Collection Editor window.

  3. In the invoked window, click the Add button to add a new Item from the Collection. Configure item parameters as illustrated in the image below.

    Your XAML may look like the following. (If it does not, you can overwrite your code with the code below.)

Expanded Create a Custom Edit Appointment Form

  1. In the Visual Studio menu, click Project | Add User Control...

    You can also press CTRL+SHIFT+A to invoke the Add New Item dialog.

    In this dialog, select the WPF group of templates, select the User Control (WPF) item, set its name to CustomAppointmentForm.xaml, and click Add.

  2. Add controls to edit the following appointment properties.

    To add these controls and specify the appointment properties that will be edited using these controls, overwrite the CustomAppointmentForm.xaml file as follows.

Expanded Create a Controller Supporting Custom Fields

Since the application's scheduling data contains a custom field (Contact) that should be edited and saved using the custom Edit Appointment form, it is necessary to inherit from the AppointmentFormController class, and create properties to support a mapped custom field.

Open the CustomAppointmentForm.xaml.cs (CustomAppointmentForm.xaml.vb) code-behind file and add the CustomAppointmentFormController class as follows.

Expanded Assign a Controller to a Custom Edit Appointment Form

To implement methods for initializing form controls, validating input, and saving the information, create a new class (a descendant of the AppointmentFormController class). To do this, add the following code to the implementation.

Expanded Replace a Standard Form with a Custom Form

  1. Handle the SchedulerControl.EditAppointmentFormShowing event to specify your custom form as the destination container and replace the default appointment editing form. To do this, select the Events tab in the Properties window, and set the EditAppointmentFormShowing event handler name to Scheduler_EditAppointmentShowing.
  2. Implement the Scheduler_EditAppointmentShowing function. To do this, add the following code to the Custom Appointment Form implementation.

Expanded Disable the Appointment Recurrence Feature

The newly created custom Edit Appointment form does not allow end users to invoke the Appointment Recurrence form and define the recurrence rule. Thus, to disable the Appointment Recurrence feature and prevent end users from working with recurring appointments, do not specify mappings for the AppointmentMapping.RecurrenceInfo and AppointmentMapping.Type standard properties of an appointment (the AppointmentMapping.RecurrenceInfo and AppointmentMapping.Type properties). Since you specified these properties, you can now clear their values.

Expanded Result

Run the project. The following image shows the Custom Appointment Form, which will be invoked when you create an appointment.

Expanded See Also

Is this topic helpful?​​​​​​​