1

Possible Duplicate:
RichTextBox (WPF) does not have string property “Text”

This is ridiculous, my RichTextBox has no document or paragraph property. How am I supposed to add text to it via C#?

<ScrollViewer Margin="16,56,16,16">
                <RichTextBox x:Name="PREVIEWTEMP"
                             HorizontalContentAlignment="Stretch"
                             VerticalContentAlignment="Top"
                             Padding="0,6,0,0"
                             Height="528"
                             Width="400"
                             IsReadOnly="True">
                    <Paragraph>
                        <Run Text="RichTextBox" />
                    </Paragraph>
                </RichTextBox>
            </ScrollViewer>

Does anyone know how to do this?

Community
  • 1
  • 1
IMX
  • 3,602
  • 4
  • 16
  • 11
  • 1
    http://stackoverflow.com/questions/957441/richtextbox-wpf-does-not-have-string-property-text – Danilo Vulović Oct 04 '12 at 11:41
  • you might also want to take a look here regarding document and paragraph, though it does not exactly answer your question: http://go4answers.webhost4life.com/Example/tabcontrol-scrollviewer-richtextbox-192242.aspx – tranceporter Oct 04 '12 at 11:44

2 Answers2

0

Paragraph needs to sit inside a element.

Take a look at this site, it has some good examples http://www.c-sharpcorner.com/UploadFile/mahesh/wpf-richtextbox/

Jay
  • 2,077
  • 5
  • 24
  • 39
0

You could create a RichTextViewer which inherits from RichTextBox as showed here (post by e-rock).

Community
  • 1
  • 1
Florian Gl
  • 5,984
  • 2
  • 17
  • 30