Skip to content

Set the time cell background in a scheduler grouped by resources.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/wpf-scheduler-customize-cell-colors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF Scheduler - Customize Cell Colors

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

image

Map the Brush Property

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

<dxsch:DataSource.ResourceMappings>
    <dxsch:ResourceMappings Brush="Brush"
                            Caption="Caption"
                            Id="Id"/>
</dxsch:DataSource.ResourceMappings>

Files to Review

Brush Set

Use the BrushSet property to declare a custom resource brush set. Refer to the following help topic for more information: Brushes and Customization.

<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>

Files to Review

Brush Provider

Use the BrushProvider property to declare a custom resource provider set. Refer to the following help topic for more information: Brush Provider.

<dxsch:SchedulerControl.BrushProvider>
    <dxsch:BrushProvider DefaultDarkCellBackground="LightCoral"                                                
                         DefaultLightCellBackground="LightSeaGreen"                                            
                         ResourceDarkCellBackground="{dxsch:OverrideBrushTransform OverrideBrush=LightGreen}"  
                         ResourceLightCellBackground="{dxsch:OverrideBrushTransform OverrideBrush=LightBlue}"/>
</dxsch:SchedulerControl.BrushProvider>

Files to Review

Time Regions

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>

Files to Review

(not recommended) Cell Style

Use the CellStyle property to declare a custom cell style for a view, as demonstrated in previous versions of this example.

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)