tags:

views:

102

answers:

3

For some reason I am not able to use the TextFlow element in WPF. Is this element/control even available?

I am using VS 2008.

+1  A: 

There is no TextFlow element. Were you looking for FlowDocument?

<ContentControl>
    <FlowDocument>
        <Paragraph>
            <Run>Hello</Run>
            <Run Background="Yellow"> World</Run>
        </Paragraph>
    </FlowDocument>
</ContentControl>
pn
No I was looking for TextFlow element. I guess the book I am reading is old and was before the release of WPF.
azamsharp
Here is one link that is using the TextFlow => http://www.longhorncorner.com/UploadFile/mahesh/XamlTextBlock06092005152009PM/XamlTextBlock.aspx?ArticleID=784e187d-9cda-4b07-bc44-b50ab0d19177
azamsharp
A: 

You can also use a TextBlock:

<TextBlock><Run>Hello</Run><Run Background="Yellow">World</Run></TextBlock>
pn
+2  A: 

If you want to avoid the default chrome of the FlowDocument, you can specify the viewer yourself:

<FlowDocumentScrollViewer>
    <FlowDocument>
        <Paragraph>
            <Run>Hello</Run>
            <Run Background="Yellow">World</Run>
        </Paragraph>
    </FlowDocument>
</FlowDocumentScrollViewer>
pn