protected override void OnTextChanged(string oldValue, string newValue) { base.OnTextChanged(oldValue, newValue); if (String.IsNullOrEmpty(Text)) { _layout.SignalEmit("elm,action,hide,button", ""); } else { _layout.SignalEmit("elm,action,show,button", ""); } }
protected virtual ELayout CreateEditFieldLayout(EvasObject parent) { var layout = new ELayout(parent); layout.SetTheme("layout", "editfield", "singleline"); layout.AllowFocus(true); layout.Unfocused += (s, e) => { SetFocusOnTextBlock(false); layout.SignalEmit("elm,state,unfocused", ""); LayoutUnfocused?.Invoke(this, EventArgs.Empty); }; layout.Focused += (s, e) => { AllowFocus(false); layout.SignalEmit("elm,state,focused", ""); LayoutFocused?.Invoke(this, EventArgs.Empty); }; layout.KeyDown += (s, e) => { if (e.KeyName == "Return") { if (!_isTexstBlockFocused) { SetFocusOnTextBlock(true); e.Flags |= EvasEventFlag.OnHold; } } }; Clicked += (s, e) => SetFocusOnTextBlock(true); Focused += (s, e) => { layout.RaiseTop(); layout.SignalEmit("elm,state,focused", ""); }; Unfocused += (s, e) => { layout.SignalEmit("elm,state,unfocused", ""); }; return(layout); }
protected override ElmSharp.Layout CreateEditFieldLayout(EvasObject parent) { _layout = base.CreateEditFieldLayout(parent); _clearButton = new EButton(_layout) { Style = "editfield_clear" }; _clearButton.AllowFocus(false); _clearButton.Clicked += ClearButtonClicked; _layout.SetPartContent("elm.swallow.button", _clearButton); _layout.SignalEmit("elm,action,show,button", ""); return(_layout); }