Completed
Last Updated: 21 Apr 2016 19:55 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 23 Sep 2015 10:19
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - InvalidCastException when adding read-only range in a paragraph
To reproduce:

RadDocument document = new RadDocument();
Section section = new Section();
Paragraph p = new Paragraph();
Span span = new Span();
span.Text ="test" + Environment.NewLine + "test";
ReadOnlyRangeStart rangeStart = new ReadOnlyRangeStart();
ReadOnlyRangeEnd rangeEnd = new ReadOnlyRangeEnd();
rangeEnd.PairWithStart(rangeStart);
p.Inlines.Add(rangeStart);
p.Inlines.Add(span);
p.Inlines.Add(rangeEnd);
section.Blocks.Add(p);
document.Sections.Add(section);
this.radRichTextEditor1.Document = document;


Workaround: add an empty span as last inline element in the paragraph:

RadDocument document = new RadDocument();
Section section = new Section();
Paragraph p = new Paragraph();
Span span = new Span();
span.Text ="test" + Environment.NewLine + "test";
ReadOnlyRangeStart rangeStart = new ReadOnlyRangeStart();
ReadOnlyRangeEnd rangeEnd = new ReadOnlyRangeEnd();
rangeEnd.PairWithStart(rangeStart);
p.Inlines.Add(rangeStart);
p.Inlines.Add(span);
p.Inlines.Add(rangeEnd);
///////////////////////////////////////
Span emptySpan = new Span();
emptySpan.Text = " ";
p.Inlines.Add(emptySpan);
///////////////////////////////////////
section.Blocks.Add(p);
document.Sections.Add(section);
this.radRichTextEditor1.Document = document;
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments