Hi,
This solution works only partially. It works only if you use a shortcut like Shift F3 and it clears the formatting.
The toggle functionality should change not only to upper but also from all upper to all lower and from lower to first upper. Fortunately I don't need toggle.
I need just to upper and to lower but not from shortcut but from context menu. Unfortunately if you use context menu the selection is lost. (it is visible, but the statement Document.Selection.IsEmpty returns true). I call it a bug.
Then there is the lost of formatting if you use
string selectedText = this.radRichTextBox.Document.Selection.GetSelectedText();
this.radRichTextBox.Insert(selectedText.ToUpper());
I replaced it with
foreach (var box in Document.Selection.GetSelectedBoxes().ToList())
{
if (!box.IsFormattingSymbol)
box.Text = box.Text.ToUpper();
}
And it almost works (from shortcut not from context menu). You need to scroll up to hide affected text and then scroll down to redraw it. I tried with Invalidate but no luck. Also undo doesn't work.
So my questions are:
Is there a way to force document to be redrawn?
Is there a way to use context menu and have access to selection?
Regards,
Daniel