Unplanned
Last Updated: 31 Oct 2018 08:06 by ADMIN
ADMIN
Todor
Created on: 27 Jun 2016 10:17
Category: RichTextBox
Type: Bug Report
1
RichTextBox: Applying a style through the StylesGallery preserves previously set local properties
If we have a paragraph containing single span which has set red foreground as a local value, applying 'Heading 1' style on that paragraph from the RadRichTextBox' Styles Gallery doesn't change the span's foreground to blue (which comes from the applied style), but preserves the red value.

Workaround: To clear a given property, basing on some logic which determines if it should be cleared. For example:
this.radRichTextBox.CommandExecuting += (s, e) =>
 {
     if (e.Command is ChangeStyleNameCommand)
     {
         var style = this.radRichTextBox.Document.StyleRepository.GetValueOrNull(e.CommandParameter.ToString());
         if (style.Type == Telerik.Windows.Documents.Model.Styles.StyleType.Paragraph)
         {
             Paragraph paragraph = this.radRichTextBox.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
             foreach (Span span in paragraph.EnumerateChildrenOfType<Span>())
             {
                 span.ClearValue(Span.ForeColorProperty);
             }
         }
     }
 };
0 comments