Clear Formatting button not removing some formatting.

2 posts, 0 answers
  1. Bob
    Bob avatar
    63 posts
    Member since:
    Aug 2010

    Posted 22 Feb 2016 Link to this post

    The "Clear Formatting" button in the RichTextBox editor menu is not removing things like the strike-through style, or margin properties from text pasted in from Microsoft Word.  Is there a simple way to have it do that?  I noticed that the "Reset All" button in the Paragraph dialog does clear the formatting better.  Is there a way to trigger the "Reset All" option when the "Clear Formatting" button is clicked?  Thanks, Jim
  2. Svetoslav
    Svetoslav avatar
    55 posts

    Posted 25 Feb 2016 Link to this post

    Hi Bob,

    Thank you for contacting us.

    I tried to reproduce the described behavior, but it seems to work as expected on my end. Please, find attached a sample video, which demonstrates the steps I performed and let me know if I am missing something.

    Overall, if you want to use the behaviour of the Reset All button of the Paragraph Properties Dialog instead of the ClearAllFomrattingCommand, I would suggest you to remove ClearAllFormattingCommand from XAML code and create your own command on button click. Here is how the command looks like in XAML:
    <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding ClearAllFormattingCommand}" Size="Small" SmallImage="{telerik:IconResource IconRelativePath=16/ClearFormatting16.png,IconSources={StaticResource IconSources}}" telerik:ScreenTip.Title="Clear All Formatting"/>

    The code snippet below demonstrates how to select a paragraph and clear all the formatting applied to it:
    private void ClearAllFomratingButtonClick(object sender, RoutedEventArgs e)
        var startPosition = this.radRichTextBox.Document.CaretPosition;
        var endPosition = new DocumentPosition(startPosition);

    I hope this helps. Let me know how it goes.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top