Advertisement
Beginner .NET MAUI, Forms, Input & Validation

How do you use Picker and BindablePicker for selections?

Short answer

Bind Picker.ItemsSource to a collection and SelectedItem (or SelectedIndex) to a view-model property; set ItemDisplayBinding to show a property of complex items. Picker presents a native selection UI on each platform.

Save .NET MAUI mock interview
Advertisement
AModel answer
Bind Picker.ItemsSource to a collection and SelectedItem (or SelectedIndex) to a view-model property; set ItemDisplayBinding to show a property of complex items. Picker presents a native selection UI on each platform.
<Picker Title="Country"
        ItemsSource="{Binding Countries}"
        ItemDisplayBinding="{Binding Name}"
        SelectedItem="{Binding SelectedCountry}" />
Real-world example
A checkout form's country dropdown binds to a list of country objects and displays their names.
Likely follow-ups
  • What is ItemDisplayBinding? | SelectedItem vs SelectedIndex?
Related topics