Change font increment for WPF RichTextBox

I am using a WPF RichTextBox control to enter some user-formatted text, including setting the font size. The built-in commands for IncreaseFontSize and DecreaseFontSize will adjust the font size by 0.75pt each time the command is executed. I would like to increase the granularity to 2pt.

Can I do this without implementing my own custom commands?

+1


source to share


2 answers


Unfortunately the value is hardcoded and you cannot change it. The fastest way to do this is to use the TextRange class. Something like that:



var range = new TextRange( rtb.Document.ContentStart, rtb.Document.ContentEnd );
range.ApplyPropertyValue( TextElement.FontSizeProperty, 30.0 );

      

+1


source


This does not work for InlineContainers, which are text blocks



0


source







All Articles