I think I got your answer. Thanks for google and stackoverflow.
WPF FlowDocument can belong to only one RichTextBox. But if you use one document that can be manipulated at different points in the user interface, then there will not be two RichTextBoxes graphic images displaying one document (and cannot, because WPF will complain). But are you using one document or several? if one, read the rest; if not, then go.
Using MemoryStream and XamlReader / Writer will not work here, since we would like to save one document and reflect the changes wherever they are used, so copying them every time is not performed. Copied from Jared member from stackoverflow,
WPF controls can be "incomparable" and reparative as they wish, so just add a RichTextBox instance to the context that will be used throughout your wizard and make sure that you are free / immune to movement from page to page. It also allows you to save any styles or changes in the state of the editors on different pages of the wizard (which is probably desirable).
If it is not possible to split an instance of RichTextBox on different pages, I think there is a way to separate the document from the original RichTextBox. It seems that in order to separate the document from RichTextBox1, you must provide RichTextBox1 with a new document. You cannot set RichTextBox1.Document to null, but you can set RichTextBox1.Document to a new FlowDocument (), and I believe this will work.
From the above, a FlowDocument cannot be used by multiple RichTextBox controls directly. So, as I noted above, use the grid
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions>
to wrap RTB and used code
FlowDocument doc = RTB1.Document; RTB1.Document = new FlowDocument(); RTB2.Document = doc;
I don't know if this will share the control, but we will see the document (one) in the other RTB.