void SetKeyboardReturnButton() { if (Control is UITextField uiTextField) { uiTextField.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(Element)); uiTextField.ShouldReturn += HandleShouldReturn; } }
void SetKeyboardReturnButton() { switch (Control) { case UITextField uiTextField: uiTextField.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(Element)); uiTextField.ShouldReturn += HandleShouldReturn; break; } }
/// <summary> /// Triggered when the Element changes /// </summary> /// <param name="e">ElementChangedEventArgs</param> protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (Control != null && Element is CustomReturnEntry customEntry) { Control.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType); Control.ShouldReturn += HandleControlShoudlReturn; } }
/// <summary> /// Triggered when an Element Property changes /// </summary> /// <param name="sender">object</param> /// <param name="e">PropertyChangedEventArgs</param> protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName.Equals(CustomReturnEntry.ReturnTypeProperty.PropertyName)) { if (Control != null && sender is CustomReturnEntry customEntry) { Control.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType); } } }
void SetKeyboardReturnButton() { var customControl = Control as UITextField; if (customControl == null) { return; } customControl.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(CustomReturnEffect.GetReturnType(Element)); customControl.ShouldReturn += HandleShouldReturn; }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); var customEntry = Element as CustomReturnEntry; if (Control != null && customEntry != null) { Control.ReturnKeyType = KeyboardHelpers.GetKeyboardButtonType(customEntry.ReturnType); Control.ShouldReturn += (UITextField tf) => { customEntry.ReturnCommand?.Execute(customEntry.ReturnCommandParameter); return(true); }; } }