private static void InsertTextCore( TextBox host, string textToInsert, int selectionStart, int selectionLength) { // delete if overwriting something if (selectionLength > 0) { DeleteSelectionCore(host, selectionStart, selectionLength); } // modify the string if (selectionStart == host.DynamicString.Length) { host.DynamicString.Append(textToInsert); } else { host.DynamicString.Insert(selectionStart, textToInsert); } // update caret and selection host.SetCaretPosition(selectionStart + textToInsert.Length); }
public CaretPositionChangedEventArgs( TextBox textControl, int oldPosition, int newPosition) { TextControl = textControl; OldPosition = oldPosition; NewPosition = newPosition; }
public DeleteTextAction( TextBox hostTextBox, int selStart, int selLength ) : base(hostTextBox) { selectionStart = selStart; selectionLength = selLength; deletedText = Textbox.Text.Substring(selectionStart, selectionLength); }
private static void DeleteSelectionCore( TextBox host, int selectionStart, int selectionLength) { if (selectionLength <= 0) { return; } // modify the string host.DynamicString.Remove(selectionStart, selectionLength); // update caret and selection host.SetCaretPosition(selectionStart); }
public TextBoxAction(TextBox hostTextBox) { Textbox = hostTextBox; }
public InsertTextAction( TextBox hostTestBox, string text, int selStart, int selLength ) : base(hostTestBox) { selectionStart = selStart; selectionLength = selLength; textToInsert = text; deletedText = Textbox.Text.Substring(selectionStart, selectionLength); }
private void mMyTextBox_TextBoxChangePending(TextBox sender, TextBoxChangeEventArgs e) { if (this.ActionManager != null && ShouldRecordActions) { IAction a = e.Action; e.Handled = true; this.ActionManager.RecordAction(a); } }
public TextBoxBlock(string defaultText) { MyTextBox = new TextBox(defaultText); Init(); }
public TextBoxBlock() { MyTextBox = new TextBox(); Init(); }