Hi,
I'm fairly new to playing with the RadRichtextBox and am wondering if anyone would know how to get around this problem. I am programatically formatting font and then adding text to a Rich Text Box like so (richTB is a RichTextBox decalred in the XAML):
Now, this works fine, the text appears at the start of the RichTextBox. My problem is that if I move the cursor to the next line, the font changes to something bigger (default font size of original Section). I've tried to remove all section of the document using:
Before writing the text I want to write to the RichTextBox but this call causes an exception (Object reference not set to an instance of an object.). Why can't I clear the collection?
Is there something wrong with removing sections? If there is, is there a way I could just change the font of the original section to use what I defined for the RadRichTextBox? That is my real problem.
Thanks,
-- Joel
I'm fairly new to playing with the RadRichtextBox and am wondering if anyone would know how to get around this problem. I am programatically formatting font and then adding text to a Rich Text Box like so (richTB is a RichTextBox decalred in the XAML):
richTB.DocumentInheritsDefaultStyleSettings = true;richTB.FontSize = 11;Section sec = new Section();Span sp = new Span();sp.Text = "Some Text I want to write to RTB";Paragraph par = new Paragraph();par.Inlines.Add(sp);sec.Blocks.Add(par);richTB.Document.Sections.AddBefore(rtb.Document.Sections.First, sec);Now, this works fine, the text appears at the start of the RichTextBox. My problem is that if I move the cursor to the next line, the font changes to something bigger (default font size of original Section). I've tried to remove all section of the document using:
richTB.Document.Sections.Clear();Before writing the text I want to write to the RichTextBox but this call causes an exception (Object reference not set to an instance of an object.). Why can't I clear the collection?
Is there something wrong with removing sections? If there is, is there a way I could just change the font of the original section to use what I defined for the RadRichTextBox? That is my real problem.
Thanks,
-- Joel