As the title suggests, my aim is to increment/decrement the font size of the current selection of text inside the RichTextBox.
This may seem trivial, and in fact it is - so long as the font size is the same for all text in the TextRange. When the selection contains text with different font sizes, the
range.GetPropertyValue(TextElement.FontSizeProperty);
which I use to get the previous value of the font size (necessary in order to know what to set the value to) returns DependencyProperty.UnsetValue .
Not only is this a problem, but also the fact that there isn't a method to increment the size, only one to explicitly set it to a given value is causing an issue here.
I've considered trying to parse the TextRange for sub ranges with different property values, but this seems like a really convoluted way to achieve something which should be trivial.
How do I go about this? Thanks in advance.
Get the TextRange through RichTextBox's Selection which will give you TextRange, and you have a double value for your fontsize. Try this