Hello,
I have a richTextDocument, I insert some lines with bold and some without.
I have a small screen sapce for this document, so I don't want to have 2 lines at the beginning.
My code is this one :
public ContextViewModel() { data = new RichTextDocument { IsReadOnly = true }; csBold = new CharacterSettings() { Bold = true }; CharacterSettings csBigSize = new CharacterSettings() { FontSize = new Extent(20, ExtentUnitType.LogicalPixels) }; pn = createParagraphNode();
InsertDetails(); }
void InsertDetails() { AddText(pn, csBold, "Version : "); AddText(pn, null, Version.ToString()); pn = createParagraphNode(); }
Is there a way to remove it ?
Regards
Thanks for this solution, now my document is working correctly
Hi Thomas,
When you first create the RichTextDocument there is already a ParagraphNode provided in the RichTextDocument.RootNode.Body.ChildNodes. This is where the beginning space is coming from. What you can do is clear this collection after you create the RichTextDocument object.
public ContextViewModel() { data = new RichTextDocument { IsReadOnly = true }; data.RootNode.Body.ChildNodes.Clear();