how can I change the font for a currently selected text area inside a WPF RichTextBox?
WPF RichTextBox: How to change selected text font
richtextboxwpf
Related Topic
- C# – RichTextBox (WPF) does not have string property “Text”
- C# – Set RTF text into WPF RichTextBox control
- Wpf – How to set RichTextBox Font for the next text to be written
- C# – How to exit a WPF application programmatically
- C# – Change font of text in RichTextBox dynamically
- C# – Change style of selected Text in RichTextBox
Best Answer
I've implemented a toolbar that can change the font size, family, color, etc. What i found is the details can be tricky with the wpf richtextbox. Setting the selection font makes some sense, but, there are also the default font properties of the text box, and the current caret properties to contend with. Here is what i've written to get it to work for most cases with the font size. The process should be the same for fontfamily and fontcolor. Hope it helps.