例如,当我选择一个国家,那么这个国家应该选择一个我在xaml或c#代码中提到的城市。
我代码:
公共分部类MainPage:如果您想创建一个新的列表,请点击这里。
public MainPage()
{
InitializeComponent();
MainPicker.Items.Add("{USA");
///现在我想当我选择美国然后美国应该选择纽约怎么做?
}
private void Button_Clicked(object sender, EventArgs e)
{
///
}
private void MainPicker_SelectedIndexChanged(object sender, EventArgs e)
{
var name = MainPicker.Items[MainPicker.SelectedIndex];
}
}
1条答案
按热度按时间kq0g1dla1#
创建一个类来为数据建模
创建数据
将数据分配给选取器
那么当选择了一个项目时