Skip to main content

How to: Create a Custom Appointment Recurrence Form (legacy)

  • 4 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 document describes how to create a custom appointment recurrence editing form using recurrence controls provided by DXScheduler for the WPF Suite and use this form instead of the default one. The default Edit Appointment form is remained unchanged in this example.

  • Open the scheduling WPF application created in Lesson 2 of the Getting Started tutorial.
  • Create a custom appointment recurrence editing form that allows end-users to set an appointment recurrence range. To do this, add a new User Control (under the CustomRecurrenceForm.xaml name) to the WpfApplication1 project. Locate the RecurrenceRangeControl and two Button (OK and Cancel) controls on this form.

    <UserControl x:Class="WpfApplication1.CustomRecurrenceForm"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:dxsch="http://schemas.devexpress.com/winfx/2008/xaml/scheduler"
                 xmlns:dxschint="http://schemas.devexpress.com/winfx/2008/xaml/scheduler/internal"
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300"
                 Loaded="UserControl_Loaded">
    
        <Grid Margin="12">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
    
            <dxsch:RecurrenceRangeControl 
                RecurrenceInfo="{Binding RecurrenceVisualController.RecurrenceInfo}"
                Pattern="{Binding RecurrenceVisualController.Controller.PatternCopy}" 
                TimeZoneHelper="{Binding TimeZoneHelper, Mode=OneTime}"
                IsEnabled="{Binding ReadOnly, Converter={dxschint:InvertedBoolConverter}}"/>
    
            <StackPanel Grid.Row="1" 
                        Orientation="Horizontal" HorizontalAlignment="Right" 
                        Margin="0,8,0,0">
                <Button x:Name="OK" Content="OK" 
                        MinWidth="75" Margin="6,0,0,0" Click="OK_Click"/>
                <Button x:Name="Cancel" Content="Cancel" 
                        MinWidth="75" Margin="6,0,0,0" Click="Cancel_Click"/>
            </StackPanel>
        </Grid>
    </UserControl>
    
  • To replace the standard Appointment Recurrence form with a newly created custom one, handle the SchedulerControl.RecurrenceFormShowing event. Set the FormShowingEventArgs.Form property to the CustomRecurrenceForm class instance with the passed AppointmentFormController controller of the Edit Appointment form that is accessed via RecurrenceFormEventArgs.ParentForm.

    <dxsch:SchedulerControl Name="schedulerControl1" 
                            HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                            ActiveViewType="Week"
                            GroupType="Resource"
                            RecurrenceFormShowing="schedulerControl1_RecurrenceFormShowing">
    
  • Run the project. The custom appointment recurrence editing form will be invoked when selecting New Recurring Appointment or New Recurring Event from the context menu, selecting Edit Series from the recurring appointment context menu or clicking the Recurrence button on the default appointment editing form.

    DefaultEditAppointmentForm_CustomRecurrenceForm

See Also