Ejemplo n.º 1
0
        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);
        }