protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); CustomEntry entry = (CustomEntry)this.Element; if (this.Control != null) { if (entry != null) { SetReturnType(entry); // Editor Action is called when the return button is pressed Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) => { if (entry.ReturnType != Models.ReturnType.Next) { entry.Unfocus(); } // Call all the methods attached to custom_entry event handler Completed entry.InvokeCompleted(); }; } } }
// Handler del click en el botón Return del teclado private void Control_EditorAction(object sender, TextView.EditorActionEventArgs e) { CustomEntry customEntry = (CustomEntry)Element; if (customEntry?.ReturnKeyType != ReturnKeyTypes.Next) { customEntry?.Unfocus(); } customEntry?.InvokeCompleted(); }
// Handler del click en el botón Return del teclado private bool TextFieldShouldReturn(UITextField textField) { CustomEntry customEntry = (CustomEntry)Element; if (customEntry?.ReturnKeyType != ReturnKeyTypes.Next) { customEntry?.Unfocus(); } customEntry?.InvokeCompleted(); return(true); }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } element = (CustomEntry)this.Element; /*******************IMAGE*******************/ var editText = this.Control; if (!string.IsNullOrEmpty(element.Image)) { switch (element.ImageAlignment) { case EnumImageAlignment.Left: editText.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(element.Image), null, null, null); break; case EnumImageAlignment.Right: editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, GetDrawable(element.Image), null); break; } } editText.CompoundDrawablePadding = 25; Control.Background.SetColorFilter(element.LineColor.ToAndroid(), PorterDuff.Mode.SrcAtop); /*******************RETURN TYPE*******************/ SetReturnType(element); // Editor Action is called when the return button is pressed Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) => { if (element?.ReturnType != EnumReturnType.Next) { element?.Unfocus(); } // Call all the methods attached to base_entry event handler Completed element?.InvokeCompleted(); }; }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); CustomEntry entry = (CustomEntry)this.Element; if (this.Control != null) { if (entry != null) { SetReturnType(entry); Control.ShouldReturn += (UITextField tf) => { entry.InvokeCompleted(); return(true); }; } } }