DxSchedulerResourceItem Class

An appointment's resource.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

Declaration

public class DxSchedulerResourceItem :
    DxSchedulerSourceObjectContainer

Remarks

The DxSchedulerResourceItem object is a resource item that can be assigned to appointments grouped by category.

Scheduler Resources

Follow the steps below to add and assign resources to Scheduler appointments:

  1. Specify the data storage for resources (ResourcesSource). The Scheduler generates a resource item (DxSchedulerResourceItem) for each item in the specified data source.
  2. Use the appointment's ResourceId mapping option to specify a data source field that stores an appointment's resource IDs.

    If an appointment has no associated resource, it belongs to all resources.

  3. Create a DxSchedulerResourceMappings object that sets up mappings for resource properties and assign this object to the ResourceMappings property.

    To apply the same color to all the appointments that correspond to a resource, map a ResourcesSource's data field to the resource's Color property and remove appointment labels.

  4. (Optional) Group appointments by resource. To do this, set the Scheduler's GroupType property to SchedulerGroupType.Resource.

<DxScheduler StartDate="@DateTime.Today"
             DataStorage="@DataStorage"
             GroupType="@SchedulerGroupType.Resource" >
    <DxSchedulerDayView DayCount="2" ShowWorkTimeOnly="true"></DxSchedulerDayView>
</DxScheduler>

@code {
    DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
        AppointmentsSource = ResourceAppointmentCollection.GetAppointmentsForGrouping(),
        AppointmentMappings = new DxSchedulerAppointmentMappings() {
            Type = "AppointmentType",
            Start = "StartDate",
            End = "EndDate",
            Subject = "Caption",
            AllDay = "AllDay",
            Location = "Location",
            Description = "Description",
            LabelId = "Label",
            StatusId = "Status",
            RecurrenceInfo = "Recurrence",
            ResourceId = "ResourceId"
        },
        ResourcesSource = ResourceAppointmentCollection.GetResourcesForGrouping(),
        ResourceMappings = new DxSchedulerResourceMappings() {
            Id = "Id",
            Caption = "Text",
            BackgroundCssClass = "BackgroundCss",
            TextCssClass = "TextCss"
        }
    };
}

An appointment gets its background color from the DxSchedulerResourceItem.Color value. If you specify an appointment's label, its color overrides the resource color.

Scheduler Resources

When users create or edit an appointment in the Appointment form, they can select the appointment's resource from the drop-down Resource list.

Scheduler Resources

If an appointment has no associated resource (the Resource drop-down list is empty), it belongs to all resources.

Run Demo: Scheduler - Resources

Inheritance

Object
DevExpress.Blazor.Scheduler.Internal.NotifyPropertyChangedBase
DxSchedulerSourceObjectContainer
DxSchedulerResourceItem
See Also