Back to Devexpress

AppointmentLabelItem.Color Property

wpf-devexpress-dot-xpf-dot-scheduling-dot-appointmentlabelitem-5cf87770.md

latest4.2 KB
Original Source

AppointmentLabelItem.Color Property

Gets or sets the appointment label‘s color.

Namespace : DevExpress.Xpf.Scheduling

Assembly : DevExpress.Xpf.Scheduling.v25.2.dll

NuGet Package : DevExpress.Wpf.Scheduling

Declaration

csharp
public Color Color { get; set; }
vb
Public Property Color As Color

Property Value

TypeDescription
Color

A Color value which represents the color used for an appointment label.

|

Remarks

Tip

The Brush property is the recommended method to assign colors to labels. The Brush property overrides the Color property. Refer to the Customize Colors topic for more information.

The Color property defines the appointment color and has the highest priority. If you set this property (either directly or by mapping), the SchedulerControl.LabelColors setting is ignored.

If you do not use the Color property, the Scheduler control takes a label color from the SchedulerControl.LabelColors palette.

You can set SchedulerControl.LabelColors directly for all themes:

xaml
<dxsch:SchedulerControl.LabelColors>
    <Color>Transparent</Color>
    <Color>Red</Color>
</dxsch:SchedulerControl.LabelColors>

An alternative approach is to override the label colors palette for a certain theme. To do this, use the DevExpress.Xpf.Scheduling.Themes.SchedulerThemeKeys.LabelColors and DevExpress.Xpf.Scheduling.Themes.SchedulerThemeKeys.LabelColors_Classic resource keys. The SchedulerThemeKeys.LabelColors_Classic resource key is only used in the Classic scheduler appearance style:

xaml
<dxsch:ColorCollection x:Key="{dxscht:SchedulerThemeKey ResourceKey=LabelColors, ThemeName=Office2019Colorful}">
    <Color>Transparent</Color>
    <Color>Red</Color>
</dxsch:ColorCollection>

If the Color property is set to Colors.Transparent , the appointment color is taken from the assigned resource item. If appointment has several assigned resources and SchedulerControl.GroupType is None, the appointment has the default theme background.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Color property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-scheduler-implement-custom-mapping-converter-for-color-values/CS/ColorMappingExample/MainWindow.xaml#L28

xml
Margin="10,10,10,10"
Color="{Binding ElementName = scheduler, Path= LabelItems[1].Color ,
                Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />

See Also

AppointmentLabelItem Class

AppointmentLabelItem Members

DevExpress.Xpf.Scheduling Namespace