Insert text into WPF textbox at caret position -
How can I insert text in a WPF text box in the carat state? What am I missing? In Win32, you can use CEdit :: ReplaceSel ().
This should work as the paste command () was implemented. But I want to avoid using the clipboard.
To enter text in the bus status:
textbox. Text = textbox.Text.Instert (text box; carat indices, "& lt; new text";);
To replace the selected text with the new text:
textbox.SelectedText = "& lt; New text & gt;";
To scroll the text box on the caret position:
int lineIndex = textbox.GetLineIndexFromCharacterIndex (textBox.CaretIndex); TextBox.ScrollToLine (lineIndex);
Comments
Post a Comment