Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1700
Why I create a ParagraphNode to begin ?
posted

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

Parents
No Data
Reply
  • 34510
    Verified Answer
    Offline posted

    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();
Children