I stumbled across the following issue. I use code like this:
int SelectionStart = textBox.SelectedView.Selection.StartOffset;
int SelectionLen = textBox.SelectedView.Selection.Length;
textBox.Document.ReplaceText(DocumentModificationType.Replace, new TextRange(SelectionStart, SelectionStart + SelectionLen), textToReplace);
When the last character is selected, I get an ArgumentException.
I should also mention that the textToReplace is longer than one character (for example 10 characters) but if I select the single character before the last one, the method works just fine.
[Modified 2 years ago]