C
C#2mo ago
RV

WPF RichTextBox is very slow

I want to make a syntax highlighter with WPF. I chose to use RichTextBox but when trying to paste about 50,000 lines into WPF richtextbox, it takes about 10 minutes to complete as in this video. I compared with textbox on winform and wpf, and compared richtextbox on winform is faster. I also did syntax highlighter with update onscroll (not in rich text box) as at the end of the video and it can display faster. But when scrolling, over time the grid becomes have many objects (TextBlock) and becomes slow. How can I do syntax highlighter in WPF efficiently and quickly?
4 Replies
RV
RVOP2mo ago
RV
RVOP2mo ago
I want to make a syntax highlighter with WPF. I chose to use RichTextBox but when trying to paste about 50,000 lines into WPF richtextbox, it takes about 10 minutes to complete as in this video. I compared with textbox on winform and wpf, and compared richtextbox on winform is faster. I also did syntax highlighter with update onscroll (not in rich text box) as at the end of the video and it can display faster. But when scrolling, over time the grid becomes have many objects (TextBlock) and becomes slow. How can I do syntax highlighter in WPF efficiently and quickly?
leowest
leowest2mo ago
I dont see wpf anywhere in your videos all I see is vscode https://github.com/icsharpcode/AvalonEdit
br4kejet
br4kejet2mo ago
Use that or make your own editor You wouldn't want to use the built in text box controls since they regenerate the Text property any time the contents change
Want results from more Discord servers?
Add your server