示例#1
0
 /// <summary>
 /// Called when focus is lost</summary>
 /// <param name="e">Event args</param>
 protected override void OnLostFocus(RoutedEventArgs e)
 {
     base.OnLostFocus(e);
     IsEditing = false;
     ValueEditorUtil.ExecuteCommand(LostFocusCommand, this, null);
     e.Handled = true;
 }
示例#2
0
        /// <summary>
        /// Called when the text changes</summary>
        /// <param name="e">Event args</param>
        protected override void OnTextChanged(TextChangedEventArgs e)
        {
            base.OnTextChanged(e);

            if (!m_ignoreTextChanges)
            {
                ValueEditorUtil.ExecuteCommand(this.TextChangedCommand, this, base.Text);
                if (IsEditing)
                {
                    m_lostFocusAction = LostFocusAction.Commit;
                }
            }
        }
示例#3
0
        private void CommitChange()
        {
            if (!m_transactionOpen)
            {
                ValueEditorUtil.ExecuteCommand(BeginCommand, this, null);
            }

            ValueEditorUtil.UpdateBinding(this, ValueProperty, false);
            ValueEditorUtil.ExecuteCommand(CommitCommand, this, null);
            m_transactionOpen = false;
            ValueEditorUtil.UpdateBinding(this, ValueProperty, UpdateBindingType.Target);

            UpdateTextFromValue();
        }
示例#4
0
        private void OnFinishEditing()
        {
            var finishEditingCommand = FinishEditingCommand;

            if (finishEditingCommand != null)
            {
                ValueEditorUtil.ExecuteCommand(finishEditingCommand, this, null);
            }
            else
            {
                //Keyboard.Focus(null);
                MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            }
        }
示例#5
0
        private void UpdateChange()
        {
            if (!m_transactionOpen)
            {
                ValueEditorUtil.ExecuteCommand(BeginCommand, this, null);
            }

            Value = UnFormat(Text);

            ValueEditorUtil.ExecuteCommand(UpdateCommand, this, null);
            m_transactionOpen = true;
            ValueEditorUtil.UpdateBinding(this, ValueProperty, UpdateBindingType.Target);

            UpdateTextFromValue();
        }