Skip to content

DayView Properties

Marvin E edited this page Apr 18, 2024 · 9 revisions

Properties

The DayView contains all the properties of a Label.

Property Type Description

DateTime

DateTime The date the view represents.

Command

ICommand The command to execute when pressed.

CommandParameter

object The command parameter of the command used when pressed.

IsCurrentMonth

bool The value used to determine if the CalendarDayView can be in the DayState.CurrentMonth or DayState.OtherMonth DayState.

IsToday

bool The value used to determine if the CalendarDayView can be in the DayState.Today DayState.

IsSelected

bool The value used to determine if the CalendarDayView can be in the DayState.Selected DayState.

IsInvalid

bool The value used to determine if the CalendarDayView can be in the DayState.Invalid DayState.

DayState

DayState The exclusive state the CalendarDayView is in.

AutoSetStyleBasedOnDayState

bool When set to true (which is its default value), the DayView will update its active style based on any properties that may change the DayState. For example DateTime or IsCurrentMonth

IsDayStateCurrentMonth

bool Indicates if the CalendarDayView's DayState is DayState.CurrentMonth.

IsDayStateOtherMonth

bool Indicates if the CalendarDayView's DayState is DayState.OtherMonth.

IsDayStateToday

bool Indicates if the CalendarDayView's DayState is DayState.Today.

IsDayStateSelected

bool Indicates if the CalendarDayView's DayState is DayState.Selected.

IsDayStateInvalid

bool Indicates if the CalendarDayView's DayState is DayState.Invalid.

CurrentMonthStyle

Style The style to apply to the control when it is in the DayState.CurrentMonth DayState. The default value for this can be accessed in the XCalendar.[Forms/Maui].Styles.DefaultStyles class which can also be referenced in XAML using the {x:Static} markup extension.

OtherMonthStyle

Style The style to apply to the control when it is in the DayState.OtherMonth DayState. The default value for this can be accessed in the XCalendar.[Forms/Maui].Styles.DefaultStyles class which can also be referenced in XAML using the {x:Static} markup extension.

TodayStyle

Style The style to apply to the control when it is in the DayState.Today DayState. The default value for this can be accessed in the XCalendar.[Forms/Maui].Styles.DefaultStyles class which can also be referenced in XAML using the {x:Static} markup extension.

SelectedStyle

Style The style to apply to the control when it is in the DayState.Selected DayState. The default value for this can be accessed in the XCalendar.[Forms/Maui].Styles.DefaultStyles class which can also be referenced in XAML using the {x:Static} markup extension.

InvalidStyle

Style The style to apply to the control when it is in the DayState.Invalid DayState. The default value for this can be accessed in the XCalendar.[Forms/Maui].Styles.DefaultStyles class which can also be referenced in XAML using the {x:Static} markup extension.

Events

IEnumerable<IEvent> The events to be shown. The default look is an indicator, the default indicator look only works with events that have a Color property such as the ColoredEvent classes in XCalendar.Forms.Models and XCalendar.Maui.Models.

EventsTemplate

ControlTemplate The template used to display the events of the Events property.

EventTemplate

DataTemplate The template used to display an event.

EventWidthRequest

double The WidthRequest of a displayed event.

EventHeightRequest

double The HeightRequest of a displayed event.

EventsSpacing

double The spacing of displayed events.

EventsOrientation

StackOrientation The orientation of the events. This can either be vertical or horizontal.

AutoEventsViewVisibility

bool When this is true, the view for events is only shown if there is at least one event. If there are no events, the view is collapsed.
When this is false, the view for events is always shown. This is useful if you're using templates and want to use custom logic that depends on the events view always being shown.

DayStates

There are 5 DayStates a CalendarDayView can be in:

  • CurrentMonth
  • OtherMonth
  • Today
  • Selected
  • Invalid

Using the above screenshot as an example:

  • The dates from 30th May - 2nd June are Invalid,
  • 6th June is Today
  • 15th June, 17th June, 18th June are Selected
  • 1st July - 10th July are OtherMonth
  • The rest are CurrentMonth.