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

.NET MAUI TemplatedPicker Commands

Telerik UI for .NET MAUI TemplatedPicker exposes a number of commands for programmatic manipulation of its popup rendering.

TemplatedPicker Commands

The TemplatedPicker for .NET MAUI exposes the following commands, which enable you to programmatically manipulate the display of the popup and the clearing of the selected item:

  • ToggleCommand—Allows you to show/hide the popup. Used for selecting an item from the custom picker.
  • ClearCommand—Allows you to clear the displayed item.

OK and Cancel Buttons

Through the popup or the drop-down, users can pick an item. This must be confirmed or rejected with the OK or Cancel buttons located in the popup or drop-down.

The TemplatedPicker allows you to add a custom logic for the Accept and Cancel commands which are executed when the OK or Cancel buttons are clicked.

  • AcceptCommand(ICommand)—Defines the command, which confirms the current selection of the picker and closes the popup or drop-down.
  • CancelCommand(ICommand)—Defines the command, which rejects the current selection of the picker and closes the popup or drop-down.

You can apply the Accept and Cancel commands for the popup mode by setting the PopupSettings property of the TemplatedPicker. For the drop-down mode, use the DropDownSettings property.


1. Define the TemplatedPicker:

    <Button Text="Toggle Command" Command="{Binding Source={x:Reference picker}, Path=ToggleCommand}"/>
    <Button Text="Clear Command" Command="{Binding Source={x:Reference picker}, Path=ClearCommand}"/>
    <telerik:RadTemplatedPicker x:Name="picker">
                <telerik:RadCalendar SelectedDate="{TemplateBinding SelectedValue, Mode=TwoWay}"/>
                <telerik:PickerPopupSettings AcceptCommand="{Binding Accept}"
                                             CancelCommand="{Binding Cancel}"/>

2. Set a sample ViewModel:

public class ViewModel
    public ViewModel()
        this.Accept = new Command(this.OnAccept);
        this.Accept = new Command(this.OnCancel);

    private void OnAccept(object obj)
        // implement your custom logic here

    private void OnCancel(object obj)
        // implement your custom logic here

    public ICommand Accept { get; set; }
    public ICommand Cancel { get; set; }

3. Set the defined ViewModel as a BindingContext of the page:

this.BindingContext = new ViewModel();

4. Add the following namespace:


See Also

In this article