wp7 - TextBlock with a lot of text - huge memory usage - how to avoid it?

后端 未结 3 1058
小蘑菇
小蘑菇 2020-12-19 21:42

I have a problem in my app and I don\'t know if it is normal or not. I have a textblock in my application that needs to display a large amount of text (2000-4000 chars). Any

3条回答
  •  一整个雨季
    2020-12-19 21:59

    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.

提交回复
热议问题