Commands
ListPicker Commands
List Picker for Xamarin exposes the following commands you can use to programmatically manipulate displaying the popup as well as clearing the selected item:
- ToggleCommand(ICommand): Allows you to show/hide the popup used for selecting an item from a list of items.
- ClearCommand(ICommand): Allows you to clear the displayed item.
PopupSelector Commands
Through the popup users can pick an item. The date value should be confirmed or rejected through the OK and Cancel buttons placed on the popup.
ListPicker 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(ICommand): Defines the command which confirms the current selection of the picker and closes the popup. AcceptCommandParameter can be used to pass a parameter to the command execute method.
- CancelCommand(ICommand): Defines the command which rejects the current selection of the picker and closes the popup. CancelCommandParameter can be used to pass a parameter to the command execute method.
The Accept and Cancel commands can be applied using the SelectorSettings property of RadListPicker. In addition, you can pass command parameters through the AcceptCommandParameter
and CancelCommandParameter
properties of the ListPicker SelectorSettings.
Example
Here is the List Picker definition:
a sample ViewModel:
and the Business model:
also you will need to add the following namespace: