/// <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; }
/// <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; } } }
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(); }
private void OnFinishEditing() { var finishEditingCommand = FinishEditingCommand; if (finishEditingCommand != null) { ValueEditorUtil.ExecuteCommand(finishEditingCommand, this, null); } else { //Keyboard.Focus(null); MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); } }
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(); }