嗨,我有一个Xamarin表单应用程序,它使用一个picker控件。它绑定到以下列表
public ObservableRangeCollection<MyType> Types { get; set; }
public class MyType
{
public string Code { get; set; }
public string Description { get; set; }
public string Status { get; set; }
}
...
public class Contact
{
public string Type{ get; set; }
}
...
<Picker x:Name="TypePicker" Title="Please select a type.."
ItemsSource="{Binding MyType}, Mode=TwoWay}"
ItemDisplayBinding="{Binding Description}"
SelectedItem="{Binding Contact.Type}" />
我见过这样的例子:
https://forums.xamarin.com/discussion/102876/how-to-get-selected-value-from-binding-picker
但这不会更新与picker使用的类型不同的类型。