protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); var newCustomEntryKeyboard = e.NewElement as EntryWithCustomKeyboard; var oldCustomEntryKeyboard = e.OldElement as EntryWithCustomKeyboard; if (newCustomEntryKeyboard == null && oldCustomEntryKeyboard == null) { return; } if (e.NewElement != null) { this.entryWithCustomKeyboard = newCustomEntryKeyboard; this.CreateCustomKeyboard(); this.inputTypeToUse = this.entryWithCustomKeyboard.Keyboard.ToInputType() | InputTypes.TextFlagNoSuggestions; // Here we set the EditText event handlers this.EditText.FocusChange += Control_FocusChange; this.EditText.TextChanged += EditText_TextChanged; this.EditText.Click += EditText_Click; this.EditText.Touch += EditText_Touch; } // Dispose control if (e.OldElement != null) { this.EditText.FocusChange -= Control_FocusChange; this.EditText.TextChanged -= EditText_TextChanged; this.EditText.Click -= EditText_Click; this.EditText.Touch -= EditText_Touch; } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); var newCustomEntryKeyboard = e.NewElement as EntryWithCustomKeyboard; var oldCustomEntryKeyboard = e.OldElement as EntryWithCustomKeyboard; if (newCustomEntryKeyboard == null && oldCustomEntryKeyboard == null) { return; } if (e.NewElement != null) { this.entryWithCustomKeyboard = newCustomEntryKeyboard; this.CreateCustomKeyboard(); this.inputTypeToUse = this.entryWithCustomKeyboard.Keyboard.ToInputType() | InputTypes.TextFlagNoSuggestions; // Here we set the EditText event handlers this.EditText.FocusChange += Control_FocusChange; this.EditText.TextChanged += EditText_TextChanged; this.EditText.Click += EditText_Click; this.EditText.Touch += EditText_Touch; this.EditText.Background = null; var lp = new MarginLayoutParams(Control.LayoutParameters); lp.SetMargins(0, 0, 0, 10); LayoutParameters = lp; Control.LayoutParameters = lp; this.EditText.SetPadding(0, 0, 0, 0); SetPadding(0, 0, 0, 0); } // Dispose control if (e.OldElement != null) { this.EditText.FocusChange -= Control_FocusChange; this.EditText.TextChanged -= EditText_TextChanged; this.EditText.Click -= EditText_Click; this.EditText.Touch -= EditText_Touch; this.EditText.Background = null; var lp = new MarginLayoutParams(Control.LayoutParameters); lp.SetMargins(0, 0, 0, 10); LayoutParameters = lp; Control.LayoutParameters = lp; this.EditText.SetPadding(0, 0, 0, 0); SetPadding(0, 0, 0, 0); } }