RecurrenceControlBase Class
A base class for recurrence controls available in the XtraScheduler library.
Namespace: DevExpress.XtraScheduler.UI
Assembly: DevExpress.XtraScheduler.v18.1.dll
Declaration
[Docking(DockingBehavior.Ask)]
[ComVisible(false)]
public class RecurrenceControlBase :
XtraUserControl,
IBatchUpdateable,
IBatchUpdateHandler
Remarks
This class implements the common functionality used by recurrent date-time controls. You should use this base class to create custom descendant recurrent controls.
The following properties and methods are specific for the RecurrenceControlBase:
- RecurrenceControlBase.RecurrenceInfo - the most significant property, specifying the recurrence pattern for display.
- RecurrenceControlBase.RecurrenceInfoChanged event handler.
- RecurrenceControlBase.CheckForWarnings
- RecurrenceControlBase.ValidateValues
- RecurrenceControlBase.UpdateControls
Example
This example shows how you can implement a custom recurrence control and use it in your appointment editing form. A control that allows you to specify hourly recurrence is created by inheriting from the RecurrenceControlBase class. A custom form used to set the Appointment.RecurrenceInfo property is displayed instead of the default appointment editing form. To accomplish this, the SchedulerControl.EditAppointmentFormShowing event is handled.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-implement-custom-recurrence-form-with-hourly-recurrence-e558
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.UI;
using System;
namespace E558
{
public partial class XtraForm1 : AppointmentRecurrenceForm
{
public XtraForm1(Appointment pattern, FirstDayOfWeek fdow, AppointmentFormController afc)
: base(pattern, fdow, afc)
{
//InitializeComponent();
checkEdit1.Tag = RecurrenceType.Hourly;
UnsubscribeRecurrenceTypeControlsEvents();
SubscribeRecurrenceTypeControlsEvents();
SetRecurrenceType(this.GetRecurrenceType());
}
protected override void InitializeControls(FirstDayOfWeek firstDayOfWeek) {
InitializeComponent();
base.InitializeControls(firstDayOfWeek);
}
protected override void SubscribeRecurrenceTypeControlsEvents()
{
base.SubscribeRecurrenceTypeControlsEvents();
if(checkEdit1 != null)
checkEdit1.EditValueChanged += new EventHandler(this.chkRecurrenceTypeChanged);
}
protected override void UnsubscribeRecurrenceTypeControlsEvents()
{
base.UnsubscribeRecurrenceTypeControlsEvents();
if (checkEdit1 != null)
checkEdit1.EditValueChanged -= new EventHandler(this.chkRecurrenceTypeChanged);
}
protected override void ChangeCurrentRecurrenceControl()
{
if (this.CurrentRecurrenceControl != null)
{
this.CurrentRecurrenceControl.Visible = false;
}
switch (this.GetRecurrenceType())
{
case RecurrenceType.Daily:
this.CurrentRecurrenceControl = this.dailyRecurrenceControl1;
break;
case RecurrenceType.Weekly:
this.CurrentRecurrenceControl = this.weeklyRecurrenceControl1;
break;
case RecurrenceType.Monthly:
this.CurrentRecurrenceControl = this.monthlyRecurrenceControl1;
break;
case RecurrenceType.Hourly:
this.CurrentRecurrenceControl = this.hourRecurrenceControl1;
break;
default:
this.CurrentRecurrenceControl = this.yearlyRecurrenceControl1;
break;
}
this.CurrentRecurrenceControl.Visible = true;
}
protected override void SetRecurrenceType(RecurrenceType type)
{
if (type == RecurrenceType.Hourly && checkEdit1 != null)
{
checkEdit1.Checked = true;
return;
}
base.SetRecurrenceType(type);
}
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the RecurrenceControlBase class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.