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

Resources

The RadScheduler allows you to define custom resources that can be assigned to the appointments. Custom resources let you associate additional information with your appointments, where the information for each field can be selected from a limited number of possibilities. For example, you can load the appointments of different users on a single scheduler by simply choosing the name of the user from a drop down. The same applies for various resources such as meeting rooms, team events, etc.

Because custom resources have a limited number of values, RadScheduler can group appointments based on the resources associated with them. For example, you can book different facilities for a variety of events. Also, the appointments can be grouped by multiple groups.

Creating ResourceTypesCollection and Populating it with ResourceType

First of all, let's set a ResourceTypesSource. Then we need to create a ResourceTypeCollection, where we can assign the ResourceType.

Example 1

<telerik:RadScheduler x:Name="scheduler"> 
    ... 
    <telerik:RadScheduler.ResourceTypesSource> 
        <telerik:ResourceTypeCollection> 
          ... 
        <telerik:ResourceTypeCollection> 
    </telerik:RadScheduler.ResourceTypesSource> 
</telerik:RadScheduler> 
After we have created a ResourceTypeCollection, we can add our ResourceType. Here is an example of creating ResourceType with name "Location":

Example 2

<telerik:RadScheduler x:Name="scheduler"> 
    ... 
    <telerik:RadScheduler.ResourceTypesSource> 
        <telerik:ResourceTypeCollection> 
            <telerik:ResourceType Name="Location"> 
             ... 
            </telerik:ResourceType> 
        </telerik:ResourceTypeCollection> 
    </telerik:RadScheduler.ResourceTypesSource> 
</telerik:RadScheduler> 
Once we've created the ResourceType, we should create and assign Resources to this group (ResourceType):

Example 3

<telerik:RadScheduler x:Name="scheduler"> 
    ... 
    <telerik:RadScheduler.ResourceTypesSource> 
        <telerik:ResourceTypeCollection> 
            <telerik:ResourceType Name="Room"> 
                <telerik:Resource ResourceName="Room 102" /> 
                <telerik:Resource ResourceName="Room 203" /> 
                <telerik:Resource ResourceName="Room 406" /> 
            </telerik:ResourceType> 
        </telerik:ResourceTypeCollection> 
    </telerik:RadScheduler.ResourceTypesSource> 
</telerik:RadScheduler> 

If you want to be able to set an appointment to multiple resources you need to set the AllowMultipleSelection property of the ResourceType to true.

The order in which the Resource objects are added to the ResourceType determines the order in which the groups will be generated in the view.

Grouping appointments by Resources

Now if you want to group the appointments by Room, you can use GroupDescriptionsSource property:

Example 4

<telerik:RadScheduler x:Name="scheduler"> 
    ... 
    <telerik:RadScheduler.GroupDescriptionsSource> 
        <telerik:GroupDescriptionCollection> 
            <telerik:ResourceGroupDescription ResourceType="Room" /> 
        </telerik:GroupDescriptionCollection> 
    </telerik:RadScheduler.GroupDescriptionsSource> 
</telerik:RadScheduler> 
The code above will group RadScheduler by resource type named Room. Day view and Week view are always grouped by date, so the new group description will be inserted before the standard DateGroupDescription:

WinUI

If you want to change the group order you could use the following syntax:

Example 5

<telerik:RadScheduler x:Name="scheduler"> 
    ... 
    <telerik:RadScheduler.GroupDescriptionsSource> 
        <telerik:GroupDescriptionCollection> 
            <telerik:DateGroupDescription /> 
            <telerik:ResourceGroupDescription ResourceType="Room" /> 
        </telerik:GroupDescriptionCollection> 
    </telerik:RadScheduler.GroupDescriptionsSource> 
</telerik:RadScheduler> 
The result will be the following (note the changed group order):

WinUI

Adding Resources in code behind

The whole example above can be also set up in the code behind:

Example 6

ResourceType locationResource = new ResourceType("Room"); 
locationResource.Resources.Add(new Resource("Room 102")); 
locationResource.Resources.Add(new Resource("Room 203")); 
locationResource.Resources.Add(new Resource("Room 406")); 
 
this.scheduler.ResourceTypesSource = new ResourceTypeCollection 
{ 
    locationResource 
}; 
 
GroupDescriptionCollection groupDescription = new GroupDescriptionCollection 
{ 
    new DateGroupDescription(), 
    new ResourceGroupDescription{ ResourceType = "Room" }                 
}; 
 
this.scheduler.GroupDescriptionsSource = groupDescription; 

See Also

In this article
Not finding the help you need?