Skip to main content
All docs
V24.1

How To: Customize Cell Colors

This example illustrates techniques to set the time cell background in a scheduler grouped by resource:

  1. In classic themes, a cell background color depends on the resource’s color. Use the following properties to specify the resource color:

    <dxsch:DataSource.ResourceMappings>  
        <dxsch:ResourceMappings Brush="Brush"  
                                Caption="Caption"  
                                Id="Id" />  
    </dxsch:DataSource.ResourceMappings>  
    
  2. Use the BrushSet property to declare a custom resource brush set . Refer to Brushes and Customization for more information:

    <dxsch:SchedulerControl.BrushSet>  
        <dxsch:BrushSet>  
            <dxsch:BrushInfo Name="{x:Static dxsch:DefaultBrushNames.Resource1}"  
                            Brush="OrangeRed" />  
            <dxsch:BrushInfo Name="{x:Static dxsch:DefaultBrushNames.Resource2}"  
                            Brush="YellowGreen" />  
        </dxsch:BrushSet>  
    </dxsch:SchedulerControl.BrushSet>  
    
  3. Use the BrushProvider property to declare a custom resource provider. Refer to Brush Provider for more information.

    <dxsch:SchedulerControl.BrushProvider>  
        <dxsch:BrushProvider DefaultDarkCellBackground="LightCoral"  
                            DefaultLightCellBackground="LightSeaGreen"  
                            ResourceDarkCellBackground="{dxsch:OverrideBrushTransform OverrideBrush=LightGreen}"  
                            ResourceLightCellBackground="{dxsch:OverrideBrushTransform OverrideBrush=LightBlue}"/>  
    </dxsch:SchedulerControl.BrushProvider>  
    
  4. Use the Time Regions feature to highlight specific time frames.

    <dxsch:DataSource AppointmentsSource="{Binding Appointments}"  
                    ResourcesSource="{Binding Resources}"  
                    TimeRegionsSource="{Binding TimeRegions}">  
        <dxsch:DataSource.TimeRegionMappings>  
            <dxsch:TimeRegionMappings Brush="Brush"  
                                    End="EndTime"  
                                    Id="Id"  
                                    ResourceId="ResourceId"  
                                    Start="StartTime" />  
        </dxsch:DataSource.TimeRegionMappings>  
    </dxsch:DataSource>
    

    View Example: How to: Customize Cell Colors