locked
How to add tag that wrap string to RichTextBox in WPF RRS feed

  • General discussion

  • Hi,

    I want to add a tag that wrap a string to RichTextBox (as "marker 59" in picture) in WPF. It should be within text. I guess it be a thumbnail. How to do it? Thanks.


    York

    • Changed type york Z Saturday, January 12, 2013 4:43 AM
    Friday, May 11, 2012 11:40 PM

All replies

  • hi,

    is it possible to give more detail

    have u tried any code or xaml for this.

    regards

    Jagan

    Saturday, May 12, 2012 7:46 AM
  • No, I have not tried. It seems to need table for this tag.


    York

    Saturday, May 12, 2012 8:32 PM
  • The WPF RichTextBox has a Document property for setting the content a la MSDN:

    // Create a FlowDocument to contain content for the RichTextBox.
            FlowDocument myFlowDoc = new FlowDocument();

            // Add paragraphs to the FlowDocument.
            myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 1")));
            myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 2")));
            myFlowDoc.Blocks.Add(new Paragraph(new Run("Paragraph 3")));
            RichTextBox myRichTextBox = new RichTextBox();

            // Add initial content to the RichTextBox.
            myRichTextBox.Document = myFlowDoc;
    You can just use the AppendText method though if that's all you're after.

    Hope that helps.

    or try any other codings.

    Sunday, May 13, 2012 6:33 AM