SchedulerStorageBase.CreateResource(Object, String) Method
Creates a new resource with the specified ID and caption.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v26.1.Core.Desktop.dll
NuGet Package: DevExpress.Scheduler.CoreDesktop
Declaration
Parameters
| Name | Type | Description |
|---|---|---|
| resourceId | Object | The unique resource identifier. |
| resourceCaption | String | The resource caption. This value is assigned to Resource.Caption property. |
Returns
| Type | Description |
|---|---|
| Resource | A new resource. |
Remarks
Use the CreateResource method to create a new resource.
void CreateSampleResource() {
Resource res = schedulerControl1.Storage.CreateResource(0, "Resource1");
schedulerStorage.Resources.Add(res);
schedulerControl1.GroupType = SchedulerGroupType.Resource;
}
The CreateResource method:
- Creates a new resource instance.
- Automatically generates required custom fields and adds them to the resource’s
CustomFieldCollection(available via the PersistentObject.CustomFields property).
To manually add custom fields to the resource, use the PersistentObjectStorage<T>.CreateCustomFields method.
Custom Resource Factory
The CreateResource method relies on a resource factory (an object that implements the IResourceFactory interface) to generate resources. To replace the default resource factory:
- Implement the
IResourceFactoryinterface. - Call the SchedulerStorageBase.SetResourceFactory method and pass your custom factory instance as a parameter.
Implements
See Also