问题描述
我有大约 800 KB 的文本要显示在屏幕上.有人可以告诉我可能的解决方案吗?
I have around 800 KB of text which I want to display on the screen. Can somebody let me know possible solution to this?
由于文本块的 2048X2048 限制,我已经尝试将文本拆分为多个文本块并尝试过 http://blogs.msdn.com/b/priozersk/archive/2010/09/08/creating-scrollable-textblock-for-wp7.aspx.这虽然适用于 40 到 50 KB 的数据,但不能扩展到 800 KB 的大小.
Because of 2048X2048 limit of textblock, I have already tried splitting the text into multiple textblocks and also tried http://blogs.msdn.com/b/priozersk/archive/2010/09/08/creating-scrollable-textblock-for-wp7.aspx. This, though works for data till 40 to 50 KB but doesn't scale to size of 800 KB.
我也尝试过使用 Listbox(如下文第一个解决方案中所述).wp7 - TextBlock with大量文本 - 大量内存使用 - 如何避免?
I have also tried using Listbox (as mentioned in the first soluion in the below post).wp7 - TextBlock with a lot of text - huge memory usage - how to avoid it?
这(如下所示)也可以工作到 80-100KB,之后加载文本需要很长时间.
This (shown below) also works till 80-100KB and after that takes too long to load the text.
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox x:Name="myListBox" Width="468" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="20" Text="{Binding}" TextWrapping="Wrap" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
推荐答案
在 Overflow7 我对文本使用 ListBox 方法 - 但我同意它有时需要很长时间才能加载.
In Overflow7 I use the ListBox approach with text - but I agree it can take a long time to load sometimes.
在 Iron7 中,我使用了显示在 WebBrowser 控件中的 HTML 页面.
In Iron7, I use an HTML page displayed within a WebBrowser control.
另一个建议是,如果你有很多文本,那么你可以看看 Kindle 如何显示文本 - Kindle for Windows Phone 7 使用的控件是什么
One other suggestion is that if you have a lot of text, then you could look at how Kindle displays text - What's the control used in Kindle for Windows Phone 7
这篇关于需要在 Windows Phone 7 屏幕上显示大量文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!