Unplanned
Last Updated: 04 Dec 2017 13:16 by ADMIN
ADMIN
Hristo
Created on: 04 Dec 2017 13:15
Category: RichTextEditor
Type: Bug Report
1
FIX. RadRichTextEditor - applying a style through the StylesGallery preserves previously set local properties
Workaround: To clear a given property, basing on some logic which determines if it should be cleared. For example
this.radRichTextEditor1.CommandExecuting += (s, e) =>
{
    if (e.Command is ChangeStyleNameCommand)
    {
        var style = this.radRichTextEditor1.Document.StyleRepository.GetValueOrNull(e.CommandParameter.ToString());
        if (style.Type == Telerik.WinForms.Documents.Model.Styles.StyleType.Paragraph)
        {
            Paragraph paragraph = this.radRichTextEditor1.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
            foreach (Span span in paragraph.EnumerateChildrenOfType<Span>())
            {
                span.ClearValue(Span.FontFamilyProperty);
                span.ClearValue(Span.FontSizeProperty);
            }
        }
    }
};
0 comments