WPF - Virtual Textbox to load large text file

Hello Experts,

I'm loading a large text file (5mb) into a richtextbox.  However it is very slow to load.  The line below is taking too long.

              TextRange range = new TextRange(PART_RichTextBox1.Document.ContentStart, PART_RichTextBox1.Document.ContentEnd);                            
range.Load(textStream, GetFileDataFormat(this.ViewModel.GetFileType()));  


How can I the improve performance?  

Thanks,
Steve
OFGeminiAsked:
Who is Participating?
 
cubaman_24Commented:
Hello:
Try using Memory-Mapped Files to avoid loading the full file at startup. Then, you can load only the text that fits in the visible area of the textbox, and do sequential access to the memory mapped file when scroll is done in the textbox.
Hope this helps.

http://msdn.microsoft.com/en-us/library/dd997372.aspx
0
 
OFGeminiAuthor Commented:
Thanks.  I'll try to implement this
0
 
sahana talankiEngineerCommented:
Where you successful in this implementation? I have similar challenges in my application. Please help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.