Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
683 views
in Technique[技术] by (71.8m points)

windows phone 7 - how many characters can a Silverlight TextBlock hold?

i am trying to put a end-user license agreement (EULA) into a WP7 silverlight textblock control. however, it keeps truncating my text. why is this happening? is there a limit on the text size or number of characters a WP7 silverlight textblock can hold?

below is an example of what i've done in terms of xaml (the rest of the xaml surrounding is the default that is auto-generated).

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <ScrollViewer>
        <TextBlock x:Name="tbMsg" TextWrapping="Wrap"/>
    </ScrollViewer>
</Grid>

i've also tried using a TextBox, but now, i can't even scroll within the TextBox. i've explicitly set the VerticalScrollBarVisibility to Visible too, but i still can't scroll down the TextBox. in fact, i don't even see the vertical scroll bar. i don't know if this observation is because i'm still viewing the UI via the emulator.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <TextBox x:Name="tbMsg" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible"/>
</Grid>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

No UIElement can be larger than 2048 pixels in either direction (height or width). Any content which would be displayed beyond this area isn't displayed. Space for where this content would be is reserved within the visual tree though.

The work around for this is to use multiple elements to display large amounts of text.

Update
I've written my own parsers for dynaically displaying content of this sort. Ideally though you won't be working with large blocks of text at runtime though. This can be further complicated when the text contains links (to other pages, web content or email launchers).

When wanting to display EULAs or any large piece of text, you won't want to make it easy for the user to read and navigate. Afterall you are including the text as you want the user to read it.

If you have the text at design time you should take the opportunity to ensure that it is laid out appropriately and using separate TextBlocks for different sections and styling headings and sub-headings appropriately can help you do this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...