How to increase height limit of the TextBlock cont

2020-03-30 16:56发布

问题:

I need to create a view with multiple TextBlocks populating thousands words. Unfortunately, when I set the Text of the TextBlock to contain a string longer than approx. 2000 characters the later part of the string is not displayed. The size of the TextBlock is still as if it contained all the characters, but the bottom of it is just blank.

Do you know what is the constraint that limit the length of the TextBlock? And how can I override it?

回答1:

This is a limitation of the TextBox implementation on Windows Phone. If the area is larger thatn 2048 x 2048 it gets clipped.

This blog post has a workaround.



回答2:

No UIElement can be greater than 2048 pixels in either dimension, however, if you exceed this limit, the space for the larger element is still reserved.

As a workaround, see this blog post which has a simple technique for splitting text into multiple TextBlocks.