I am trying to highlight selected text in the radrichtextbox. I was looking at an example from back in June and it appears that it is not working for me. Now I understand the method ChangeTextColor has been changed to ChangeTextHighlightColor. While the forums post says this code highlights the selected text.This code selects the current line and highlights the whole thing not the selected text. Let me know if I am doing something wrong but this code does not work for me. In addition to this requirement. I also have a requirement to insert an inline ui object. Now I can get this inserted at the end of the selection or where the caret is currently but I cannot get this inline object inserted at the beginning of the selection.
private void HighLight_Click(object sender, RoutedEventArgs e)
{
this.richTextBox.Document.Selection.Clear();
DocumentPosition position = new DocumentPosition(this.richTextBox.Document.CaretPosition);
position.MoveToCurrentLineStart();
this.richTextBox.Document.Selection.AddSelectionStart(position);
position.MoveToCurrentLineEnd();
this.richTextBox.Document.Selection.AddSelectionEnd(position);
this.richTextBox.ChangeTextBackColor(Colors.Green);
}