2

Is there any way to display scrollabletext in loose xaml? The equivalent in HTML would be

<div style="overflow:scroll">some long bit of text here</div>

Can you do this in loose xaml?

From my experiments so far it seems that in loose xaml:

  1. You cannot use TextBox -- it must be TextBlock.
  2. TextBlock doesn't seem to have any styling settings which would make it scrollable.
  3. ScrollViewer doesn't seem to be allowed in loose xaml.

Any help gratefully appreciated.

4

2 回答 2

1

You can use a textbox for scrolling text e.g.:

<TextBox Text="{Binding YourText}" VerticalContentAlignment="Top"
 TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
MaxHeight="200" MaxWidth="300"/>

This will show scrollbars if your text doesn't fit in the displayed area.

于 2008-10-22T12:29:17.450 回答
1
<ScrollViewer Height="239" VerticalScrollBarVisibility="Auto">
<toolkit:PhoneTextBox x:Name="newcTextBox" AcceptsReturn="True"  TextWrapping="Wrap"/>
</ScrollViewer>
于 2013-04-03T05:52:21.587 回答