Need to show large amount of text on windows phone 7 screen
Asked Answered
M

2

2

I have around 800 KB of text which I want to display on the screen. Can somebody let me know possible solution to this?

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.

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?

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>
Malvasia answered 26/3, 2011 at 12:22 Comment(1)
Coming to senses that it's not such a good idea to show the huge text at once to the user, I have started showing only certain number of textBlocks to the user (in this case 50). When the user presses some button after 50 textblocks, the same page will be updated for the next 50 textBlocks. Though not the best possible solution but I am kinda ok with thisMalvasia
L
2

In Overflow7 I use the ListBox approach with text - but I agree it can take a long time to load sometimes.

In Iron7, I use an HTML page displayed within a WebBrowser control.

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

Laevo answered 26/3, 2011 at 12:35 Comment(0)
N
1

I know this is an old question, however I wanted to add one more solution.

http://blogs.msdn.com/b/stankovski/archive/2013/08/27/yet-another-scrollable-textblock-for-windows-phone.aspx

To accomplish my task I have encapsulated the "splitting" logic into a separate class that produces the output as a List of strings. You can then bind that list to your favorite ListBox control and voila, you have a ginormous text block. The splitting logic has been optimized for performance so you'll get a much better processing time then ScrollableTextBlock by Alex. Also, since you can bind the list to any ListBox control that supports virtualization you will have a much more conservative memory footprint.

Niobous answered 27/8, 2013 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.