A newer version of this page is available. Switch to the current version.

SchedulerControl.GetResourceColorSchemasCopy() Method

Returns copies of color schemas that are currently used to paint visible resources.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v19.2.dll


public SchedulerColorSchemaCollection GetResourceColorSchemasCopy()
Public Function GetResourceColorSchemasCopy As SchedulerColorSchemaCollection


Type Description

A SchedulerColorSchemaCollection object.


Call the GetResourceColorSchemasCopy method to get the collection of the currently used resource color schema copies. By default, if you change a set of visible resources (for example, by using resource filter controls) the collection of resource color schemas will remain unchanged, i.e. the same color schemas in the same order will be used to paint resources, newly selected to be displayed in the scheduler.


However, you can assign a specific color schema to each visible resource. To do this, handle the SchedulerControl.QueryResourceColorSchema event.



This example demonstrates how to link a specific SchedulerColorSchema to each visible resource.

Call the SchedulerControl.GetResourceColorSchemasCopy method to obtain a collection of color schemas that are currently available for resource coloring (according to the currently active skin) and handle the SchedulerControl.QueryResourceColorSchema event to associate a specific color schema from the obtained collection to each resource displayed in the scheduler control.


A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3209.

using DevExpress.XtraScheduler;
using System.Collections.Generic;
// ...

namespace QueryResourceColorSchema {
    public partial class Form1 : Form {
        public Form1() {

            // Get copies of color schemas that are curremnty used to paint resources.

            schedulerControl1.LookAndFeel.StyleChanged += new EventHandler(LookAndFeel_StyleChanged);

        void LookAndFeel_StyleChanged(object sender, EventArgs e) {
            // Get copies of color schemas to be used to paint resources
            // after the active skin has been changed.


        // ...

        Dictionary<object, SchedulerColorSchema> resourceColorSchemas = 
            new Dictionary<object, SchedulerColorSchema>();

        private void PrepareResourceColorSchemas() {
            int count = Resources.Count;
            SchedulerColorSchemaCollection currentColorSchemas = 
            int schemaCount = currentColorSchemas.Count;
            for (int i = 0; i < count; i++) {
                Resource resource = schedulerControl1.Storage.Resources[i];
                this.resourceColorSchemas.Add(resource.Id, currentColorSchemas[i % schemaCount]);

        private void schedulerControl1_QueryResourceColorSchema(object sender, 
                                                                QueryResourceColorSchemaEventArgs e) {
            object key = e.Resource.Id;
            if (this.resourceColorSchemas.ContainsKey(key))
                e.ResourceColorSchema = this.resourceColorSchemas[key];
See Also