New to Telerik UI for Xamarin? Download free 30-day trial

Selection

RadDatePicker control enables the app users to quickly and easily select a date value. This topic will go through the provided by the DatePicker API related to date selection.

Important Properties

  • Date(DateTime?): Defines the current date selection. The default value is null.

Check below a quick example of Time property usage:

<telerikInput:RadDatePicker Date="2020,05,15"
                            SpinnerFormat="yyy-MMM"/>

In addition to this, you need to add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

Methods

Date Picker for Xamarin allows you to clear the selected date through its ClearSelection method

Example

<StackLayout>
    <Button Text="Clear Selection" Clicked="OnClearSelectionClicked"/>
    <telerikInput:RadDatePicker x:Name="datePicker"/>
</StackLayout>

In addition to this, you need to add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

Call ClearSelection inside the button click event - as a result Date property will be updated to null.

private void OnClearSelectionClicked(object sender, EventArgs e)
{
    this.datePicker.ClearSelection();
}

Events

RadTime Picker exposes a SelectionChanged event which is raised when the user picks a time value.

Example

<telerikInput:RadDatePicker SelectionChanged="RadDatePicker_SelectionChanged"/>

In addition to this, you need to add the following namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

and the SelectionChanged event, where the sender is the RadDatePicker control

private void RadDatePicker_SelectionChanged(object sender, EventArgs e)
{
    // implement your logic here
}

See Also

In this article