简体   繁体   中英

WPF RichTextBox lock paragraph font

I'm trying to figure out how the documents in RichTextBox work. What I want to achieve is to change selected text font but, not replace a specific one.
So whenever I select text and press a button to replace the font it should keep that one I want but replace all others.

You can call .Selection.GetPropertyValue(TextElement.FontFamilyProperty) to evaluate currently applied font and then apply .Selection.ApplyPropertyValue(TextElement.FontFamilyProperty, "your-font-here") if all necessary conditions are satisfied.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM