question

Abhishek-3228 avatar image
0 Votes"
Abhishek-3228 asked ·

RichEditBox performance is slow when loading large text files

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?

windows-uwpwindows-uwp-xaml
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

mrlacey avatar image
0 Votes"
mrlacey answered ·

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.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichardZhang-MSFT avatar image
0 Votes"
RichardZhang-MSFT answered ·

Hello,

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.

Thanks.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.