New to Telerik UI for WinForms? Download free 30-day trial

Working with Resources

When RadScheduler is grouped by resources, it stores them in the Resources collection. Each Resource offers the following properties:

Resource's properties Description Type
Name Gets or sets the name of the resource. string
Id Gets or sets the id of the resource. EventId
Image Gets or sets the image of the resource. Image
Visible Gets or sets a value indicating whether this resource is visible. bool
Color Gets or sets the color that is associated with the resource. Color

One Appointment may refer to one or many resources. Each Appoinment offers two properties that allow managing its resource/resources:

  • ResourceId - represents the EventId of the resource to which this appointment is associated.
  • ResourceIds - represents an ObservableCollection of EventIds to which this appointment is associated.

Using the EditAppointmentDialog allows you to assign only a single resource for the appointment. If you want to specify which multiple resources exactly are applied, it can be set programmically to the Appointment via the ResourcesIds property. However, selecting Any from the dialog, will generate an event for all existing resources in RadScheduler.

Apply a single resource to an appointment

Appointment appointment = new Appointment(DateTime.Today.AddDays(1).AddHours(12).AddMinutes(30), TimeSpan.FromHours(2), "Business Lunch");
appointment.ResourceId = this.radScheduler1.Resources[2].Id;
this.radScheduler1.Appointments.Add(appointment);

Dim appointment As Appointment = New Appointment(DateTime.Today.AddDays(1).AddHours(12).AddMinutes(30), TimeSpan.FromHours(2), "Business Lunch")
appointment.ResourceId = Me.radScheduler1.Resources(2).Id
Me.radScheduler1.Appointments.Add(appointment)

winforms-scheduler-working-with-resources 001

Apply multiple resources to an appointment

Appointment appointmentWithMultipleResources = new Appointment(DateTime.Today.AddDays(1).AddHours(12).AddMinutes(30), TimeSpan.FromHours(2), "Business Lunch");
appointmentWithMultipleResources.ResourceIds.Add(this.radScheduler1.Resources[2].Id);
appointmentWithMultipleResources.ResourceIds.Add(this.radScheduler1.Resources[1].Id);
this.radScheduler1.Appointments.Add(appointmentWithMultipleResources);

Dim appointmentWithMultipleResources As Appointment = New Appointment(DateTime.Today.AddDays(1).AddHours(12).AddMinutes(30), TimeSpan.FromHours(2), "Business Lunch")
appointmentWithMultipleResources.ResourceIds.Add(Me.radScheduler1.Resources(2).Id)
appointmentWithMultipleResources.ResourceIds.Add(Me.radScheduler1.Resources(1).Id)
Me.RadScheduler1.Appointments.Add(appointmentWithMultipleResources)

winforms-scheduler-working-with-resources 002

When multiple resources are associated with an appointment, the Resource field in the EditAppointmentDialog shows Any:

winforms-scheduler-working-with-resources 003

See Also

In this article
Not finding the help you need? Improve this article