[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Collapse]Scheduler (legacy)
   [Expand]Overview
   [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]Fundamentals
   [Expand]Visual Elements
   [Expand]Examples
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Lesson 8 - Create a Custom Appointment Recurrence Dialog Using the MVVM Pattern (legacy)

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.

In this lesson, you will learn how to use the MVVM design pattern to customize the default Appointment Reccurence dialog, which can be invoked by clicking the Recurrence button in the Edit Appointment form.

Important

Before starting the example, you must perform the steps described in Lesson 7 - Create a Custom Edit Appointment Form Using the MVVM Pattern (legacy) of the current tutorial. This lesson demonstrates how to create the scheduling application and customize the default appointment editing form by utilizing an MVVM-based mechanism for form display.

The tutorial includes the following sections.

Expanded Enable the Recurrence Functionality

  1. Open the WPF application with the SchedulerControl, which was created in Lesson 7 - Create a Custom Edit Appointment Form Using the MVVM Pattern (legacy) of the current tutorial.

  2. Open the MainViewModel file and implement the Recurrence and Type properties of the HospitalAppointment class. The values of these properties will be used to save and load the recurrence information in the data source (in this example, the System.ComponentModel.BindingList<HospitalAppointment> collection is used to define the data source).

    Show Me

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

  3. Switch to the MainWindow.xaml file. Use the AppointmentStorage.Mappings property to bind an appointment's Appointment.RecurrenceInfo and Appointment.Type properties to the Recurrence and Type fields of the data source.

    Show Me

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

Expanded Add the Recurrence Button to the Edit Appointment Form

Open the HospitalAppointmentForm.xaml file. Add the Recurrence button to the form next to the Cancel button. Bind the button to EditRecurrenceCommand to enable creating and editing recurring appointments using the Appointment Recurrence dialog.

Show Me

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

Expanded Create a Custom Appointment Recurrence Dialog

  1. In the Solution Explorer, right-click the project's name (MVVMSchedulerApplication) and select Add | User Control...

  2. In the Add New Item dialog, select the WPF group of templates, click the User Control (WPF) item, change its name to HospitalRecurrenceForm.xaml, and then click Add.

  3. Locate the RecurrenceTypeEditor, DailyRecurrenceControl, WeeklyRecurrenceControl, MonthlyRecurrenceControl and RecurrenceRangeControl controls on the Recurrence form. To enable editing the recurrence pattern of an appointment, bind the added controls to the corresponding property values of the DevExpress.Xpf.Scheduler.UI.RecurrenceDialogViewModel object, which serves as a data context for any bindings within the form.

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

    Show Me

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

Expanded Use a Data Template to Display the Custom Dialog

Switch to the MainWindow.xaml file. To invoke the created Appointment Recurrence form, you need to specify a data template that contains a service used to display the form's View. By default, the DialogService is used as a service to show the dialog window. Utilize the SchedulerControl.AppointmentRecurrenceDialogServiceTemplate property to specify the data template. To display your custom form instead of the standard one, set the ViewServiceBase.ViewTemplate property to HospitalRecurrenceForm. To define the style and size of the dialog, utilize the DialogService.DialogStyle property. The XAML code implementing this approach is shown below.

Show Me

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

Expanded Result

Run the project. Double-click any appointment or create a new one to invoke the Edit Appointment form. In the form, click the Recurrence button to display the custom Appointment Recurrence dialog shown in the image below.

Expanded See Also

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