public override void ViewDidLoad() { base.ViewDidLoad(); this.CreateBinding(TipLabel).To((TipViewModel vm) => vm.Tip).Apply(); this.CreateBinding(SubTotalTextField).To((TipViewModel vm) => vm.SubTotal).Apply(); this.CreateBinding(GenerositySlider).To((TipViewModel vm) => vm.Generosity).Apply(); View.AddGestureRecognizer(new UITapGestureRecognizer(() => { SubTotalTextField.ResignFirstResponder(); })); }
public override void ViewDidLoad() { base.ViewDidLoad(); var set = this.CreateBindingSet <TipView, TipViewModel>(); set.Bind(TipLabel).To(vm => vm.Tip); set.Bind(SubTotalTextField).To(vm => vm.SubTotal); set.Bind(GenerositySlider).To(vm => vm.Generosity); set.Apply(); // this is optional. What this code does is to close the keyboard whenever you // tap on the screen, outside the bounds of the TextField View.AddGestureRecognizer(new UITapGestureRecognizer(() => { SubTotalTextField.ResignFirstResponder(); })); }
public override void ViewDidLoad() { base.ViewDidLoad(); var bindingSet = this.CreateBindingSet <TipView, TipViewModel>(); bindingSet.Bind(TipLabel).To(vm => vm.Tip); bindingSet.Bind(SubTotalTextField).To(vm => vm.SubTotal); bindingSet.Bind(GenerositySlider).To(vm => vm.Generosity); bindingSet.Bind(GenerosityTextField).To(vm => vm.Generosity); bindingSet.Apply(); // close keyboard when the screen is tapped outside // the bounds of the SubTotalTextField View.AddGestureRecognizer(new UITapGestureRecognizer(() => { SubTotalTextField.ResignFirstResponder(); })); }
partial void TapGestureRecognized(UITapGestureRecognizer sender) { SubTotalTextField.ResignFirstResponder(); }