Silverlight TextBlock 可以容纳多少个字符? [英] how many characters can a Silverlight TextBlock hold?

查看:25
本文介绍了Silverlight TextBlock 可以容纳多少个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将最终用户许可协议 (EULA) 放入 WP7 silverlight 文本块控件中.然而,它不断截断我的文字.为什么会这样?WP7 silverlight 文本块可以容纳的文本大小或字符数是否有限制?

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?

下面是我在 xaml 方面所做的一个例子(xaml 周围的其余部分是自动生成的默认值).

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>

我也尝试过使用 TextBox,但现在,我什至无法在 TextBox 内滚动.我也明确地将 VerticalScrollBarVisibility 设置为 Visible,但我仍然无法向下滚动 TextBox.事实上,我什至没有看到垂直滚动条.我不知道这个观察是否是因为我仍在通过模拟器查看 UI.

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>

推荐答案

任何UIElement 在任一方向(高度或宽度)都不能大于 2048 像素.不会显示超出此区域的任何内容.尽管在可视化树中保留了此内容所在的空间.

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).

当想要显示 EULA 或任何大段文本时,您不会想让用户轻松阅读和导航.毕竟,您要包含希望用户阅读的文本.

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.

这篇关于Silverlight TextBlock 可以容纳多少个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆