Skip to main content
All docs
V24.1

DateNavigator.RequestCellAppearance Event

Occurs when a date cell state is changed and allows you to change the date cell’s appearance values.

Namespace: DevExpress.Xpf.Editors.DateNavigator

Assembly: DevExpress.Xpf.Core.v24.1.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public event DateNavigatorRequestCellAppearanceEventHandler RequestCellAppearance

Event Data

The RequestCellAppearance event's data class is DateNavigatorRequestCellAppearanceEventArgs. The following properties provide information specific to this event:

Property Description
Appearance Gets or sets cell appearance.
CacheValue Gets or sets whether the event should cache the date cell’s appearance value in the specified state.
CalendarView Gets the calendar view.
CellState Gets the cell state.
DateTime Gets the cell’s date.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
IsMouseOver Gets whether the mouse cursor is over the cell.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

You can set the CacheValue event argument to true to save the combination of the CalendarView and Appearance properties for a date cell’s CellState on the next event raise.

If the date cell’s properties are cached, the RequestCellAppearanceEvent will not be raised for this date cell.

You can use the RefreshCellAppearances() method to raise the RequestCellAppearance event for an each date cell and clear the cached appearance values.

The following code sample changes the 9.18.2020 date cell’s appearance and caches appearance values:

<Window ...
  xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">
  <StackPanel>
    <dxe:DateNavigator
        x:Name="dateNavigator"
        CalendarView="Month"
        RequestCellAppearance="RequestCellAppearance">
        <dxe:DateNavigator.Appearance>
            <dxe:DateNavigatorCellAppearance>
                <dxe:DateNavigatorCellAppearance.SelectedState>
                    <dxe:DateNavigatorStateAppearance
                        Background="LightCyan"
                        BorderBrush="Black"
                        BorderThickness="1"
                        Foreground="Black" />
                </dxe:DateNavigatorCellAppearance.SelectedState>
            </dxe:DateNavigatorCellAppearance>
        </dxe:DateNavigator.Appearance>
    </dxe:DateNavigator>
  </StackPanel>
</Window>
using DevExpress.Xpf.Editors.DateNavigator;
...
void RequestCellAppearance(object sender, DateNavigatorRequestCellAppearanceEventArgs args) {
    DateTime day = new DateTime(2020, 9, 18);
    if (args.DateTime.Date == day && args.CellState.HasFlag(DateNavigatorCalendarCellState.Selected)) {
        args.Appearance.Background = Brushes.Blue;
        args.Appearance.Foreground = Brushes.White;
        args.CacheValue = true;
    }
}

See Also