Scheduler List Views work with events (IEvent objects) and resources (IResource objects).
XAF's Business Class Library implements these interfaces in Event and Resource classes. In some cases, you may need to extend these classes or even implement their corresponding interfaces from scratch.
The example in this repository implements the following scenarios:
NOTE
Instructions below describe classes specific to Entity Framework Core ORM. For XPO-specific classes refer to the following files:
- "c:\Program Files\DevExpress 2X.Y\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.Xpo\Event.cs"
- "c:\Program Files\DevExpress 2X.Y\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.Xpo\Resource.cs"
-
Create a new event class and add properties. See the #region Base Properties section in the source code. It contains all
IEventproperties exceptResourceId. -
Implement a resource object. See the #region Resources section in the source code.
The
IEventinterface requires a stringResourceIdproperty that stores a collection of resources in an XML string (required by the Scheduler control). In XAF, we recommend that you add an associated collection of objects instead. Add theResourceIdstring property and theResourcescollection property and set up synchronization between them. -
Implement
IRecurrentEvent. See the #region IRecurrentEvent section in the source code. -
Implement
IReminderEvent. See the #region IReminderEvent section in the source code.Note Reminders are currently not supported in XAF Scheduler Module for ASP.NET Core Blazor. Skip this section for ASP.NET Core Blazor applications.
-
Add Blazor compatibility options. See the #region Blazor compatibility section in the source code. Skip this step if you do not plan to implement the
Eventclass in an ASP.NET Core Blazor application. -
Implement object construction. See the #region Construction section in the source code.
If you need to initialize a property (for example the
StartOnorEndOnproperty) when XAF creates a newCustomEvent, override theOnCreatedevent. -
If you want to add validation, see the #region Validation section in the source code.
To use the Validation Module, add validation rules to your object. For example, you can demand that the
StartOndate always precedes theEndOndate.
-
Implement the
IResourceinterface in theApplicationUserclass.Note
In this example, we implementIResource.Idexplicitly becauseApplicationUseralready has anIDproperty. This implicit implementation causes an ambiguous exception in Windows Forms applications that use Entity Framework Core ORM. To resolve this issue, remap the Scheduler to theIDproperty directly instead of theIResource.Idproperty. For implementation details, refer to CustomEventWithUserResourcesController.cs. -
If you implement
IResourcein multiple classes, specify a Resource class for the corresponding Scheduler List View. For more information, refer to the following topic: Use a Custom Resource Class.
-
Enable drag-and-drop in Scheduler.
By default, Scheduler does not allow to edit objects. You need to set the AllowEdit property to
truein the Model.DesignedDiffs.xafml file. -
Customize the
StartandEndproperties to show time.By default,
DateTimeproperty editors only display date. ChangeDisplayFormatandEditMaskto show and edit time. For details, see the Model.DesignedDiffs.xafml file.
-
If you want to create a One-to-Many relationship between a resource and events, change
ResourceIdimplementation. For details, see the following source file: CustomEventWithCustomResource.cs. -
Create a custom
Resourceclass and implement theIResourceinterface. For implementation details, see the following source file: CustomResource.cs.
- CustomEventWithUserResources.cs
- ApplicationUser.cs
- CustomEventWithUserResourcesController.cs
- CustomResource.cs
- CustomEventWithCustomResource.cs
(you will be redirected to DevExpress.com to submit your response)