RichEditBox performance is slow when loading large text files

Abhishek 21 Reputation points

RichEditBox hangs UI when loading the larger text files.
File read operation takes 1 ms time but when we are setting data to richeditbox, it will hangs UI (for 2 seconds) and also loader looks likes stuck (unresponsive).
Is there any way of increase the performance of RichEditBox?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Matt Lacey 791 Reputation points MVP

    You could try adding the text a bit at a time (rather than all at once) and releasing the UI thread between each bit you add.
    If the file must all be loaded and the contents can't be changed to make loading faster, you'll have to change the way it is loaded to minimize the time the UI is blocked.

    0 comments No comments

  2. Richard Zhang-MSFT 6,921 Reputation points


    Welcome to Microsoft Q&A!

    If you load a lot of text at once, the text will be rendered on the UI thread, which means the UI will get stuck.

    For text controls such as RichTextBlock, the text is usually sliced.

    For example, the novel can be separated according to chapters, a String is processed into a List<String>, and then only a part is loaded at a time.


    0 comments No comments