WPF RichTextBox: How to change selected text font?

前端 未结 5 1676
暗喜
暗喜 2020-12-18 09:46

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

5条回答
  •  无人及你
    2020-12-18 09:59

    Solved...

    if (this.TextEditor.Selection.IsEmpty)
        this.TextEditor.CurrentFontFamily = SelectedFont;
    else
        this.TextEditor.Selection.ApplyPropertyValue(TextElement.FontFamilyProperty, SelectedFont);
    

提交回复
热议问题