1

How to place text and Button in a same line in WPF Richtextbox?

In the image below some texts and a button control are placed in a richtextbox.

enter image description here

I want some texts to be placed before and after the button in the same line.

Is it possible to define some width to the blockuicontainer or a wayout to achieve the same?

What I want is:

enter image description here

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
  • Oo Some additional information would be helpful. How about a scribble? – DHN Apr 08 '13 at 07:30
  • I have added brief description of my question. – Chandan Kumar Rath Apr 08 '13 at 08:11
  • It's still unclear. Do you want to have the text flowing around the `Button`, because you only have one large text? Are there two texts, so that you can have one `TextBox` before and one after the `Button`? – DHN Apr 08 '13 at 08:22
  • I have edited the image to show what I want. Please have a look again. These are simple texts(not textboxes) before and after the button. – Chandan Kumar Rath Apr 08 '13 at 09:13

1 Answers1

0

I have added a FlowDocument to the RichTextBox and a Paragraph to the FlowDocument.

Sample code is:

Paragraph para = new Paragraph();
        FlowDocument fd = new FlowDocument();
        fd.Blocks.Add(para);
        txtExpression.Document = fd;
        para.Inlines.Add(new Button() { Content = "Hello!" });
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72