Вот пример для вашего вопроса. В Xaml есть
:
<Picker x:Name="PickerOne" Title="Select First" TitleColor="Red">
<Picker x:Name="PickerTwo" Title="Select Second" TitleColor="Green" IsEnabled = "False">
<Picker x:Name="PickerThree" Title="Select Three" TitleColor="Blue" IsEnabled = "False">
In ContentPage , настройка ItemSource
:
var monkeyList = new List<string>();
monkeyList.Add("Baboon");
monkeyList.Add("Capuchin Monkey");
monkeyList.Add("Blue Monkey");
monkeyList.Add("Squirrel Monkey");
monkeyList.Add("Golden Lion Tamarin");
monkeyList.Add("Howler Monkey");
monkeyList.Add("Japanese Macaque");
PickerOne.ItemsSource = monkeyList;
PickerTwo.ItemsSource = monkeyList;
PickerThree.ItemsSource = monkeyList;
и добавление SelectedIndexChanged
метод:
PickerOne.SelectedIndexChanged += PickerOne_SelectedIndexChanged;
PickerTwo.SelectedIndexChanged += PickerTwo_SelectedIndexChanged;
void PickerOne_SelectedIndexChanged(object sender, EventArgs e)
{
var picker = (Picker)sender;
int selectedIndex = picker.SelectedIndex;
if (selectedIndex != -1)
{
PickerTwo.IsEnabled = true;
}else{
PickerTwo.IsEnabled = false;
}
}
void PickerTwo_SelectedIndexChanged(object sender, EventArgs e)
{
var picker = (Picker)sender;
int selectedIndex = picker.SelectedIndex;
if (selectedIndex != -1)
{
PickerThree.IsEnabled = true;
}else{
PickerThree.IsEnabled = false;
}
}