Exemplo n.º 1
0
 protected override void OnTextChanged(TextChangedEventArgs e)
 {
     base.OnTextChanged(e);
     if (this.ignoreTextChanges)
     {
         return;
     }
     ValueEditorUtils.ExecuteCommand(this.TextChangedCommand, this, base.Text);
     if (this.IsEditing)
     {
         this.lostFocusAction = StringEditor.LostFocusAction.Commit;
     }
 }
Exemplo n.º 2
0
 private void InternalLostFocus()
 {
     StringEditor.LostFocusAction lostFocusAction = this.lostFocusAction;
     this.lostFocusAction = StringEditor.LostFocusAction.None;
     if (lostFocusAction == StringEditor.LostFocusAction.Commit)
     {
         this.CommitChange();
         return;
     }
     if (lostFocusAction == StringEditor.LostFocusAction.Cancel)
     {
         this.CancelChange();
     }
 }
Exemplo n.º 3
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            bool handlesCommitKeys = ValueEditorUtils.GetHandlesCommitKeys(this);

            if (e.Key == Key.Return || e.Key == Key.Return)
            {
                StringEditor.LostFocusAction lostFocusAction = this.lostFocusAction;
                this.lostFocusAction = StringEditor.LostFocusAction.None;
                bool modifiers = (e.KeyboardDevice.Modifiers & ModifierKeys.Shift) == ModifierKeys.None;
                if (lostFocusAction == StringEditor.LostFocusAction.Commit)
                {
                    if (!modifiers)
                    {
                        this.UpdateChange();
                    }
                    else
                    {
                        this.CommitChange();
                    }
                }
                if (modifiers)
                {
                    this.OnFinishEditing();
                }
                KeyEventArgs handled = e;
                handled.Handled = handled.Handled | handlesCommitKeys;
            }
            else if (e.Key == Key.Escape && this.IsEditing)
            {
                StringEditor.LostFocusAction lostFocusAction1 = this.lostFocusAction;
                this.lostFocusAction = StringEditor.LostFocusAction.None;
                if (lostFocusAction1 != StringEditor.LostFocusAction.None)
                {
                    this.CancelChange();
                }
                this.OnFinishEditing();
                KeyEventArgs keyEventArg = e;
                keyEventArg.Handled = keyEventArg.Handled | handlesCommitKeys;
            }
            base.OnKeyDown(e);
        }