, если есть подобная функция для UIPickerViews в Xamarin?
Да!Вы можете реализовать это в UIPickerView
.
string[] DisplayMembers = new string[] { "January", "February", "March",...,"December" };
int[] ValueMembers = new int[] {1,2,3,...,12 };
И в методе Delegate
public override nint GetRowsInComponent(UIPickerView pickerView, nint component)
{
return DisplayMembers.Length;
}
public override string GetTitle(UIPickerView pickerView, nint row, nint component)
{
if (component == 0)
return DisplayMembers[row];
else
return row.ToString();
}
public override void Selected(UIPickerView pickerView, nint row, nint component)
{
//...
var valueMember=ValueMembers[row].ToString();
// do something you want about valueMember
}