Hello,
Welcome to our Microsoft Q&A platform!
You need to set the selected text before you want to change the font or the size. If you haven't selected some text, neither font or size will be changed when you click the ComboBox. So you shouldn't use richEbitBox.Document.GetText() but use richEbitBox.Document.Selection.SetRange() instead.
For example, the following code shows how to change all the text sizes.
MyBox.Document.Selection.SetRange(0, MyBox.Document.Selection.EndPosition);
switch (id.Tag)
{
case "1":
//Todo implement new font name
string fontName = id.SelectedItem.ToString();
MyBox.Document.Selection.CharacterFormat.Name = fontName;
break;
case "2":
var size = (float)id.SelectedItem;
//set size to the Selection
MyBox.Document.Selection.CharacterFormat.Size = size;
break;
default:
break;
}
Thanks.