.NET MAUI DateTimePicker Selection
The DateTimePicker control enables the application users to quickly and select a date value by providing an API related to date selection.
Date Property
The Date
(DateTime?
) property defines the current date selection. Its default value is null
.
The following example demonstrates how to set the Date
property.
In addition to this, you need to add the following namespace:
Clear Button
You can enable a Clear button which can be used to quickly remove the selected value. To enable the button, set IsClearButtonVisible
property of the DateTimePicker:
Methods
The DateTimePicker for .NET MAUI allows you to clear the selected date through its ClearSelection
method:
In addition to this, you need to add the following namespace:
Call ClearSelection
inside the button click
event. As a result, the Date
property will be updated to null
.
Events
The DateTimePicker exposes a SelectionChanged
event, which is raised when the user picks a date value.
The following example demonstrates how to use SelectionChanged
.
In addition to this, you need to add the following namespace:
Add the SelectionChanged
event, where the sender
is the RadDateTimePicker
instance.