我有大约800 KB的文本,我想要在屏幕上显示。有人可以让我知道可能的解决方案吗?需要在windows phone 7屏幕上显示大量的文本
由于2048X2048文本块的限制,我已经尝试将文本拆分为多个文本块,并尝试使用http://blogs.msdn.com/b/priozersk/archive/2010/09/08/creating-scrollable-textblock-for-wp7.aspx。这虽然适用于40到50 KB的数据,但不能扩展到800 KB的大小。
我也试过使用Listbox(如下面的帖子中提到的第一个soluion)。 wp7 - TextBlock with a lot of text - huge memory usage - how to avoid it?
这个(下面显示的)也可以工作到80-100KB,之后需要太长时间才能加载文本。
<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>
为了感觉到向用户显示巨大文本并不是一个好主意,我已经开始向用户显示一定数量的textBlocks(在本例中为50)。当用户在50个文本块之后按下某个按钮时,下一个50个文本块将会更新相同的页面。虽然不是最好的解决方案,但我对此很满意 – abnvp 2011-03-28 16:54:22