I want to move the caret 4 positions to the right of where my caret currently is. I\'m registered for PreviewKeyDown, and calling InsertTextInRun()
Use the GetInsertionPosition() method on the CaretPosition TextPointer. This will allow you to insert the text before the caret.
private void rtb_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Tab)
{
rtb.CaretPosition.GetInsertionPosition(LogicalDirection.Backward).InsertTextInRun(" ");
e.Handled = true;
}
}