TemplatedPicker Commands

TemplatedPicker for .NET MAUI exposes the following commands you can use to programmatically manipulate displaying the popup as well as clearing 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.

PopupSelector Commands

Through the popup users can pick an item. The value should be confirmed or rejected through the OK and Cancel buttons placed on the popup.

TemplatedPicker allows you to add a custom logic for the Accept and Cancel commands which are executed when OK and Cancel buttons, respectively, are pressed.

  • AcceptCommand: Defines the command which confirms the current selection of the picker and closes the popup.
  • CancelCommand: Defines the command which rejects the current selection of the picker and closes the popup.

The Accept and Cancel commands can be applied using the SelectorSettings property of RadTemplatedPicker.


Here is the RadTemplatedPicker definition:

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

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; }

Set thus defined ViewModel as a BindingContext of the page:

this.BindingContext = new ViewModel();

also you will need to add the following namespace:


See Also

In this article
Not finding the help you need?