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!" });