views:

53

answers:

1

Hi, how can I change the font for a currently selected text area inside a WPF RichTextBox?

+1  A: 

How about something like:

 TextSelection text = richTextBox.Selection; 
 if (!text.IsEmpty) 
 { 
     text.ApplyPropertyValue(RichTextBox.FontSizeProperty, value); 
 }
KrisTrip
That is for the font size at least. Theres probably a property for the font family if thats what you wanted to change.
KrisTrip
Almost there. It works for the font size.But for the font family it changes the entire paragraph and not the selection only.
Néstor Sánchez A.