views:

866

answers:

2

I'm using a WPF RichTextBox control to input some text with user formatting capability, including font size adjustment. 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 this be done without implementing my own custom commands?

+1  A: 

Unfortunately the value is hard-coded and you cannot change it. The fastest way to implement this is to use the TextRange class. Something like this:

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

That doesn't work for InlineContainers that are text blocks