[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements and Structure
   [Expand]Data Binding
   [Collapse]Appointments
     Appointment Labels and Statuses
     Reminders for Appointments
     Resources for Appointments
   [Expand]Views
   [Expand]Import and Export
    Printing
   [Expand]Reports
   [Expand]Time Zones
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
   [Expand]Services
   [Expand]Member Tables
   [Expand]Visual Elements
   [Expand]Examples
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Resources for Appointments

An appointment is typically associated with a resource. A resource is an abstraction and its actual interpretation depends on a particular application. In a project schedule, a resource is an employee, in a car sharing service — a vehicle, etc. This document explains how to assign resources to appointments and provides examples.

Expanded Overview

The SchedulerControl.DataStorage property provides access to a SchedulerDataStorage object that represents a storage for appointments and resources. The SchedulerDataStorage.Resources property provides access to a ResourceStorage object that represents a storage for resources. Use its ResourceStorageBase.Items property to access the collection of resources. A resource is an object that implements the Resource interface:

Expanded Assign Resources to Appointments

To assign a resource to an appointment, assign the resource's IPersistentObject.Id property value to the appointment's Appointment.ResourceId property.

Note that the resource should be contained in the resource storage. Otherwise, the appointment is not loaded into the appointment storage. In particular, it means that appointments with associated resources are not displayed in a scheduler with empty resource storage.

If an appointment has no associated resource, it belongs to all resources. Enable the SchedulerOptionsViewBase.ShowOnlyResourceAppointments option to display appointments only with associated resources.

An appointment can be associated with multiple resources. For example, a single task can be assigned to multiple employees. To associate an appointment with multiple resources, use the appointment's Appointment.ResourceIds collection.

Note that the appointment storage's AppointmentStorageBase.ResourceSharing property should be set to true to allow resources to share appointments.

In the image below, you can see how users can assign multiple resources to an appointment.

Note

When multiple resources are associated with an appointment, resource identifiers are serialized in the XML format. Starting from version 15.2, the control uses Base64 encoding for XML serialization. Set the static (Shared in VB) SchedulerCompatibility.Base64XmlObjectSerialization property to false to revert to the previous serialization format. For more information, see the Data Sources topic.

Expanded Appointment Groups

Each appointment has a date and can have an associated resource. Dates are displayed at the top of the view.

Resources are only displayed if appointments are grouped. To group the appointments, set the SchedulerControl.GroupType property to one of the following values:

The Timeline View displays resources vertically on the left and dates horizontally at the top, regardless of the group type.

The Agenda View does not support groups.

Options

The options below are only in effect when appointments are grouped.

Resource Navigator

The Resource Navigator is automatically displayed when appointments are grouped. The navigator allows users to do the following:

To hide the navigator, set the ResourceNavigator.Visibility property to ResourceNavigatorVisibility.Never.

Resource Visibility

If a resource's Resource.Visible property is set to false, the resource's appointments are hidden.

Expanded Resource Categories

You can arrange resources in separate categories. For example, you can create a business and personal category.

The ResourceCategory class represents a category where you can place resources. Use the ResourceCategory.Resources collection to add resources to the category. When categories are created and populated with resources, add them to the SchedulerControl.ResourceCategories collection.

In the code below, resources are arranged into categories according to the ParentId field.

Note

Run the XtraScheduler demo and click Open Solution for the complete example.

Options

The SchedulerOptionsView.ResourceCategories property provides access to options that are only applied when resources are organized into categories.

Resource Display Style

The ResourceCategoryOptions.ResourceDisplayStyle property specifies how to display resources in categories:

  • Tabs — each resource in a category is displayed as a separate tab and users can select a resource (tab) in a category. The ResourceCategory.SelectedResource property specifies the selected resource.

  • Headers — all resources in a category are displayed as a single category header and users cannot select a resource in a category (you can select a resource in code).

    If resources are displayed as category headers, you can use the ResourceCategory.Caption property to provide a custom caption for the category.

    If appointments are grouped by dates, resources are always displayed as category headers.

Appointment Display Mode

The ResourceCategoryOptions.AppointmentDisplayMode property specifies how to display appointments in a category depending on the selected resource:

  • AllResources — a category displays appointments for all resources, regardless of the selected resource.

  • SelectedResource — a category displays appointments for the selected resource only.

Expanded Resource Appearance

Appointment Color Schemas

The SchedulerControl.ResourceColorSchemas property provides access to color schemas used to paint appointments associated with a resource. The code below shows how to specify the background color.

You can also specify color schemas in the Visual Studio Designer.

Tip

You can use the WinForms Skin Editor to modify color schemas.

Appointment Background Color

Use a resource's extension ResourceExtension.SetColor method, to specify the background color for appointments associated with the resource. The code below shows how to specify the background color for appointments associated with the Work resource.

Resource Image

Use a resource's extension ResourceExtension.SetImage method to assign an image to the resource. The image is displayed in the resource header. You can also use the Resource.ImageBytes property to specify the image.

Resource Headers

The SchedulerOptionsView.ResourceHeaders property provides access to options that specify Resource Headers.

Expanded Filter Resources

To filter resources in code, handle the SchedulerDataStorage.FilterResource event.

The example below shows how to filter resources in a scheduler. The filter shows the first three resources only.

Filter Controls

The ResourcesCheckedListBoxControl, ResourcesComboBoxControl, and ResourcesPopupCheckedListBoxControl controls can be attached to a scheduler to allow users filter resources.

Expanded Resource Tree

You can organize resources in a tree. A resource's IPersistentObject.Id property specifies the resource's identifier. Use the Resource.ParentId property to specify the identifier of the parent resource. If this property is set to null (Nothing in VB), the resource is at the root level.

See the Hierarchical Resource Specifics topic to learn how to use data source fields to organize resources in a tree.

Tree Control

The ResourcesTree control displays resources organized in a tree. The ResourcesTree.SchedulerControl property specifies the bound scheduler. You can use this control to display resources in the Timeline or Gantt view.

See Resources Tree for more information.

Expanded See Also

Is this topic helpful?​​​​​​​