Our WinForms Scheduler Control can now arrange resources into categories. Resources that belong to a specific category can be presented as tabs or displayed as colored columns. This feature delivers two distinct benefits:
- allows you to re-arrange resources and combine closely related resources into groups (in the figure below, business-related and personal resources are grouped into two separate categories);
- allows you to create a more “space-efficient” user interface (when compared to our standard “group by resource” mode) and allows the Scheduler to display more resources on-screen.
To create categories, first set the GroupType property to “Resource”. Each category is an object of the DevExpress.XtraScheduler.ResourceCategory
class. Scheduler stores these objects in its ResourceCategories collection. To place a resource into a category, you need to add it to the category’s Resources
collection. The following code from the Scheduler Demo (Tabs demo module) arranges resources by their parent.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
usingSystem.Linq;
voidGroupByParentId() {
varcategories =
this.schedulerDataStorage1.Resources.Items
// group resources by their parent resource IDs
.GroupBy(x => x.ParentId ?? x.Id)
// merge resources with equal parent IDs
// into ResourceCategory objects
.Select(x => {
varrc = newResourceCategory();
foreach (Resourceresourceinx) {
rc.Resources.Add(resource);
}
returnrc;
});
// add created ResourceCategories objects to the Scheduler
foreach (ResourceCategorycatincategories) {
Scheduler.ResourceCategories.Add(cat);
}
}
Resources are displayed as tabs when the OptionsView.ResourceCategories.ResourceDisplayStyle
property is set to Tabs
. You can also set this property to Header
to display standard resource headers. In this instance, headers display the names of all Resources for a given Category (separated by commas).
Note: if you enable the OptionsView.ResourceCategories.ShowResourcesAsTabs
property, but do not manually group resources, each resource will be automatically placed into a stand-alone category.
Your feedback matters
We’d love to know your thoughts on this new feature. Are there any additional features you’d like to see us add? Category captions? Close buttons in tab headers? Drag-and-drop functionality so that end-users could move resources between categories? Please share your thoughts in the comment section below.