New to Telerik UI for .NET MAUI? Start a free 30-day trial

.NET MAUI Calendar Events

The Telerik UI for .NET MAUI Calendar component exposes a set of events that users trigger through interaction. You can handle these events and customize the configuration of the UI component.

The Calendar for .NET MAUI exposes the DisplayDateChanged and the SelectionChanged events.

DisplayDateChanged

The DisplayDateChanged event is invoked when the current display date is changed. The DisplayDateChanged event handler receives two parameters:

  • The sender argument, which is of type object, but can be cast to the RadCalendar type.
  • A ValueChangedEventArgs<DateTime> object, which provides both the old and new values of the DisplayDate property. The values are of type DateTime.

The following example demonstrates how to use the DisplayDateChanged event:

1. Define the Calendar:

<Grid>
    <telerik:RadCalendar x:Name="calendar"
                         DisplayDateChanged="OnDisplayDateChanged" />
</Grid>

2. And the event handler:

private void OnDisplayDateChanged(object sender, ValueChangedEventArgs<System.DateTime> e)
{
    App.Current.MainPage.DisplayAlert("Date is ","" + e.NewValue, "OK");
}

SelectionChanged

The SelectionChanged event is invoked when the selection changes. The SelectionChanged event handler receives two parameters:

  • The sender, which is the RadCalendar control.
  • The CalendarSelectionChangedEventArgs object, which provides the following properties:
    • RemovedDates—The deselected dates.
    • AddedDates—The selected dates.

The following example demonstrates how to use the SelectionChanged event:

1. Define the Calendar:

<Grid>
    <telerik:RadCalendar x:Name="calendar"
                         SelectionChanged="OnSelectionChanged" />
</Grid>

2. And the event handler:

private void OnSelectionChanged(object sender, Telerik.Maui.Controls.Calendar.CalendarSelectionChangedEventArgs e)
{
    App.Current.MainPage.DisplayAlert("You have selected: ", "" + e.AddedDates.FirstOrDefault(), "OK");
}

See Also

In this article