C
C#3mo 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
RVOP3mo ago
RV
RVOP3mo 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
leowest3mo ago
I dont see wpf anywhere in your videos all I see is vscode https://github.com/icsharpcode/AvalonEdit
bighugemassive3
bighugemassive33mo 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