Xamarin.iOS + MvvmCross: UIPickerView data binding, SelectedItemChanged event


UI initialization:

          

_pickerView = new UIPickerView();
_pickerView.ShowSelectionIndicator = true;
_pickerViewModel = new MvxPickerViewModel(_pickerView);
_pickerView.Model = _pickerViewModel;
_pickerViewModel.SelectedItemChanged += PickerViewModel_SelectedItemChanged;

selection changed Event:
           

_pickerViewModel.SelectedItemChanged += PickerViewModel_SelectedItemChanged;


data binding:

            

set.Bind(_pickerViewModel).For(p => p.ItemsSource).To(vm => vm.Groups);
set.Bind(_pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Password.Group);

reference:

http://stackoverflow.com/questions/17646033/changing-content-of-mvxpickerviewmodel

http://stackoverflow.com/questions/18463705/mvxpickerviewmodel-bind-to-property-of-an-object

https://github.com/MvvmCross/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross.Binding.Touch/Views/MvxPickerViewModel.cs

http://forums.xamarin.com/discussion/5805/uipickerview-example



你可能感兴趣的:(Xamarin.iOS + MvvmCross: UIPickerView data binding, SelectedItemChanged event)