Skip to main content
A newer version of this page is available. .

ResourceStorage Class

A storage which holds a collection of appointment’s resources.

Namespace: DevExpress.Xpf.Scheduler

Assembly: DevExpress.Xpf.Scheduler.v18.2.dll

Declaration

public class ResourceStorage :
    PersistentObjectStorageBase<IResourceStorageBase, Resource>

The following members return ResourceStorage objects:

Remarks

Important

You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.

Appointments in the Scheduler control can be associated with resources. A resource is an object that exposes the Resource interface.

The Scheduler control allows appointments to be grouped by resources. Use the SchedulerControl.GroupType property to specify the required group mode.

The ResourceStorage class represents a storage which holds resources. The functionality of the ResourceStorage class can be accessed via the SchedulerStorage.ResourceStorage property. To get the collection of resources, use the ResourceStorage.Items property.

To associate a resource with an appointment, this resource should be added to the ResourceStorage object and then bound to the appointment via the Appointment.ResourceId property. It represents a resource ID specified by the IPersistentObject.Id property.

Connecting the ResourceStorage object to a data source via the PersistentObjectStorage<T>.DataSource and PersistentObjectStorage<T>.DataMember properties enables bound mode. In this mode, if the ResourceStorage.AutoReload property is set to true, resources are automatically retrieved from the specified data source and added to the ResourceStorage object, and when data in the data source is modified, the ResourceStorage object automatically reloads the data. If the AutoReload property is set to false, data is not automatically loaded and reloaded from the data source. You should use the SchedulerStorage.RefreshData method to reload data manually in this case.

Use the ResourceStorage.Mappings property to specify which fields in the bound data source hold a resource’s caption, color and ID. The values of these fields will be synchronized with the corresponding properties of Resource objects.

Appointments for the Scheduler control are stored in the AppointmentStorage object. In bound mode, appointments are retrieved from and stored back to a data source specified by the DataSource and DataMember properties of the AppointmentStorage object (see Lesson 5 - Bind a Scheduler to Entity Framework Data Source (legacy)). This data source may contain a field which holds the resource ID of appointments. To enable the resource ID to be automatically retrieved from the database, set the AppointmentMapping.ResourceId property to the name of this field (How to: Bind a Scheduler to MS Access Database (Part 2) (legacy)).

Example

This example demonstrates how to get access to the scheduler storage and modify its properties. For this, the SchedulerControl.Storage property is used.

<dxsch:SchedulerControl.Storage>
    <dxsch:SchedulerStorage>

        <dxsch:SchedulerStorage.AppointmentStorage>
            <dxsch:AppointmentStorage>
                <dxsch:AppointmentStorage.Mappings>
                    <dxsch:AppointmentMapping
                        Start="StartTime" 
                        End="EndTime" 
                        AllDay="AllDay"
                        Description="Description"
                        Label="Label"
                        Location="Location"
                        Subject="Subject" 
                        RecurrenceInfo="RecurrenceInfo"
                        ReminderInfo="ReminderInfo"
                        ResourceId="CarId" 
                        Status="Status"
                        Type="EventType"/>
                </dxsch:AppointmentStorage.Mappings>
            </dxsch:AppointmentStorage>
        </dxsch:SchedulerStorage.AppointmentStorage>

        <!--region #ResourceMappings-->
        <dxsch:SchedulerStorage.ResourceStorage>
            <dxsch:ResourceStorage>
                <dxsch:ResourceStorage.Mappings>
                    <dxsch:ResourceMapping Caption="Model" Id="ID" Image="Picture"/>
                </dxsch:ResourceStorage.Mappings>
            </dxsch:ResourceStorage>
        </dxsch:SchedulerStorage.ResourceStorage>
        <!--endregion #ResourceMappings-->

    </dxsch:SchedulerStorage>
</dxsch:SchedulerControl.Storage>

The following code snippets (auto-collected from DevExpress Examples) contain references to the ResourceStorage class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
DispatcherObject
DependencyObject
Visual
UIElement
FrameworkElement
DevExpress.Xpf.Core.DXFrameworkElement
DevExpress.Xpf.Scheduler.SchedulerFrameworkElement
DevExpress.Xpf.Scheduler.PersistentObjectStorageBase<IResourceStorageBase, Resource>
ResourceStorage
See Also