private void SetReturnType(CustomKeyEntry entry) { ReturnType type = entry.ReturnType; switch (type) { case ReturnType.Go: Control.ImeOptions = Android.Views.InputMethods.ImeAction.Go; Control.SetImeActionLabel("Go", ImeAction.Go); break; case ReturnType.Next: Control.ImeOptions = ImeAction.Next; Control.SetImeActionLabel("Next", ImeAction.Next); break; case ReturnType.Send: Control.ImeOptions = ImeAction.Send; Control.SetImeActionLabel("Send", ImeAction.Send); break; case ReturnType.Search: Control.ImeOptions = ImeAction.Search; Control.SetImeActionLabel("Search", ImeAction.Search); break; default: Control.ImeOptions = ImeAction.Done; Control.SetImeActionLabel("Done", ImeAction.Done); break; } }
private void SetReturnType(CustomKeyEntry entry) { ReturnType type = entry.ReturnType; switch (type) { case ReturnType.Go: Control.ReturnKeyType = UIReturnKeyType.Go; break; case ReturnType.Next: Control.ReturnKeyType = UIReturnKeyType.Next; break; case ReturnType.Send: Control.ReturnKeyType = UIReturnKeyType.Send; break; case ReturnType.Search: Control.ReturnKeyType = UIReturnKeyType.Search; break; case ReturnType.Done: Control.ReturnKeyType = UIReturnKeyType.Done; break; default: Control.ReturnKeyType = UIReturnKeyType.Default; break; } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); CustomKeyEntry entry = (CustomKeyEntry)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 != XamarinApplication.Behavior.ReturnType.Next) { entry.Unfocus(); } // Call all the methods attached to custom_entry event handler Completed entry.InvokeCompleted(); }; } } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); CustomKeyEntry entry = (CustomKeyEntry)this.Element; if (this.Control != null) { if (entry != null) { SetReturnType(entry); Control.ShouldReturn += (UITextField tf) => { entry.InvokeCompleted(); return(true); }; } } }