Back to Devexpress

DateNavigator.RequestCellAppearance Event

wpf-devexpress-dot-xpf-dot-editors-dot-datenavigator-dot-datenavigator-2e376f6a.md

latest7.8 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public event DateNavigatorRequestCellAppearanceEventHandler RequestCellAppearance
vb
Public Event RequestCellAppearance As DateNavigatorRequestCellAppearanceEventHandler

Event Data

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

PropertyDescription
AppearanceGets or sets cell appearance.
CacheValueGets or sets whether the event should cache the date cell’s appearance value in the specified state.
CalendarViewGets the calendar view.
CellStateGets the cell state.
DateTimeGets the cell’s date.
HandledGets 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.
IsMouseOverGets whether the mouse cursor is over the cell.
OriginalSourceGets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEventGets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
SourceGets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

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

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

DateNavigatorRequestCellAppearanceEventArgs

CacheValue

DateNavigator Class

DateNavigator Members

DevExpress.Xpf.Editors.DateNavigator Namespace