tags:

views:

259

answers:

2

My TextBlock has for example 50x50 pixels to display text, however if there is more text, I want a user to be able to scroll. Is there an autoscroll feature for this control?

Should I use a different control better suited for this task?

Here's a couple of pics to illustrate the problem:

This one works fine because the text fits in snugly: alt text

This one doesn't seem correct. Text is cut off. alt text

+4  A: 

Just in case someone comes into the same problem. Just wrap the textBlock with a control. Works like a charm!

<ScrollViewer Background="Black">
    <TextBlock x:Name="textBlockBackStory" 
               FontSize="12" 
               Foreground="Orange" 
               TextWrapping="Wrap"                       
               Background="Black" 
               TextDecorations="None">
                            Backstory here.
    </TextBlock>      
</ScrollViewer>
Sergio Tapia
That's exactly right, just wrap it in a scrollviewer. I often end up setting the horizontal scrollbar to auto too
Rob Fonseca-Ensor
+1  A: 

You can put your textblock inside a ViewBox, so the font will adjust to display the entire text.

Gustavo Cavalcanti
that might end up shrinking the font smaller than you can see. It is a valid option, but I think a scrollviewer will be a better choice in many situations
Rob Fonseca-Ensor