Remove Formatting Of Last Selected Text In A WPF RichTextBox Control
Here's how to remove the formatting of last selected text in a WPF RichTextBox control from it's SelectionChanged event.
C# Code
Output
C# Code
1 2 3 4 5 6 | private void rtbEditor_SelectionChanged(object sender, RoutedEventArgs e) { //Clear previous selections. TextRange textRange = new TextRange(rtbEditor.Document.ContentStart, rtbEditor.Document.ContentEnd); textRange.ClearAllProperties(); } |
Output
Comments
Post a Comment