blazor-devexpress-dot-blazor-dot-dxschedulerdatastorage-bec45cf9.md
Specifies whether an appointment can be shared between multiple resources.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public bool EnableMultipleResources { get; set; }
| Type | Description |
|---|---|
| Boolean |
true if a Scheduler appointment can have multiple resources; otherwise, false.
|
The DevExpress Blazor Scheduler component allows you to assign multiple resources to an appointment. This feature is useful for the following cases: meetings with multiple participants, group events, or services that require coordination among various resources.
Follow the steps below to enable this functionality:
Set the EnableMultipleResources property to ‘true’.
Add a new data field (Resources) to an appointment’s source object.
Map this field to the ResourceId appointment property.
Show Complete Code
<DxScheduler @bind-StartDate="@StartDate"
DataStorage="@DataStorage"
GroupType="SchedulerGroupType.Resource"
CssClass="demo-sc-size"
AppointmentFormMode="SchedulerAppointmentFormMode.EditForm">
<DxSchedulerDayView DayCount="2" ShowWorkTimeOnly="true"></DxSchedulerDayView>
</DxScheduler>
@code {
DateTime StartDate { get; set; } = DateTime.Today;
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
AppointmentsSource = MultipleResourceAppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence",
ResourceId = "Resources"
},
ResourcesSource = ResourceCollection.GetResources(),
ResourceMappings = new DxSchedulerResourceMappings() {
Id = "Id",
Caption = "Name",
BackgroundCssClass = "BackgroundCss",
TextCssClass = "TextCss"
},
EnableMultipleResources = true
};
}
public class Appointment {
public Appointment() { }
public int AppointmentType { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public string Location { get; set; }
public int? Label { get; set; }
public int Status { get; set; }
public bool AllDay { get; set; }
public string Recurrence { get; set; }
public int? ResourceId { get; set; }
public string Resources { get; set; }
public bool Accepted { get; set; }
}
public static partial class MultipleResourceAppointmentCollection {
public static List<Appointment> GetAppointments() {
DateTime date = DateTime.Now.Date;
return new List<Appointment>() {
new Appointment {
Accepted = true,
Caption = "Install New Router in Dev Room",
StartDate = date + (new TimeSpan(0, 10, 0, 0)),
EndDate = date + (new TimeSpan(0, 12, 0, 0)),
Status = 1,
Resources = DxSchedulerResourceIdCollection.ToXml(0)
},
new Appointment {
Caption = "Upgrade Personal Computers",
Accepted = false,
StartDate = date + (new TimeSpan(0, 13, 0, 0)),
EndDate = date + (new TimeSpan(0, 14, 30, 0)),
Status = 2,
Resources = DxSchedulerResourceIdCollection.ToXml(0, 1)
},
new Appointment {
Caption = "Website Redesign Plan",
Accepted = false,
StartDate = date + (new TimeSpan(1, 9, 30, 0)),
EndDate = date + (new TimeSpan(1, 11, 30, 0)),
Status = 3,
Resources = DxSchedulerResourceIdCollection.ToXml(0, 1, 2)
},
new Appointment {
Caption = "Approve Personal Computer Upgrade Plan",
Accepted = true,
StartDate = date + (new TimeSpan(0, 14, 0, 0)),
EndDate = date + (new TimeSpan(0, 16, 0, 0)),
Status = 2,
Resources = DxSchedulerResourceIdCollection.ToXml(2, 3, 4)
},
};
}
}
public class Resource {
public int Id { get; set; }
public int? GroupId { get; set; }
public string Name { get; set; }
public bool IsGroup { get; set; }
public string TextCss { get; set; }
public string BackgroundCss { get; set; }
public string ImageFileName => $"employees/{Id + 1}.jpg";
public override bool Equals(object obj) {
Resource resource = obj as Resource;
return resource != null && resource.Id == Id;
}
public override int GetHashCode() {
return Id;
}
}
public static partial class ResourceCollection {
public static List<Resource> GetResourcesForGrouping() {
return GetResources().Take(3).ToList();
}
public static List<Resource> GetResources() {
return new List<Resource>() {
new Resource() { Id=0 , Name="Nancy Davolio", GroupId=100, BackgroundCss="dxbl-green-color", TextCss="text-white" },
new Resource() { Id=1 , Name="Andrew Fuller", GroupId=101, BackgroundCss="dxbl-orange-color", TextCss="text-white" },
new Resource() { Id=2 , Name="Janet Leverling", GroupId=100, BackgroundCss="dxbl-purple-color", TextCss="text-white" },
new Resource() { Id=3 , Name="Margaret Peacock", GroupId=101, BackgroundCss="dxbl-indigo-color", TextCss="text-white" },
new Resource() { Id=4 , Name="Steven Buchanan", GroupId=100, BackgroundCss="dxbl-red-color", TextCss="text-white" }
};
}
public static List<Resource> GetResourceGroups() {
return new List<Resource>() {
new Resource() { Id=100, Name="Sales and Marketing", IsGroup=true },
new Resource() { Id=101, Name="Engineering", IsGroup=true }
};
}
}
Users can specify multiple resources in the Appointment edit form.
If you group appointments by resource, multi-resource appointments appear under all linked resources.
Run Demo: Scheduler Resources - Multiple Resources
See Also