Question

I have a requirement to create an application that will open up about 10 mb log files and highlight certain expressions.

I thought using WPF and richtextbox will work, but the richtextbox rending time is unacceptable.

Is there anything that has richtextbox like highlighting, but has better performance?

There any other way to accomplish this?

Was it helpful?

Solution

Scintilla http://www.scintilla.org/ is used as a box for editing code. It provides highlighting for many different code syntax. You may be able to use it and specify the portions you need highlighted.

OTHER TIPS

If you do not need to allow the user to edit the logs you may be able to get away with using a TextBlock and wrap the sections to be highlighted in <Style> tags which accomplish the highlighting.

How are you generating your Flowdocument - depending on what you are doing you may be able to speed it up. However, I too have run into these issues, especially because you have to generate the FlowDocument on the UI thread and if it takes too long you end up with a black screen.

If I understand what you're saying, you want a syntax highlighting RTB control. My personal favorite is the AvalonEdit control, (Here's an article on codeproject about it: http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor) which can syntax highlight like the editor in Visial Studio. It even has autocomplete, which your end users will love.

If you want something else, there's also the ICSharp Code editor. (Here's another article on codeproject about it: http://www.codeproject.com/Articles/30936/Using-ICSharpCode-TextEditor) This one pretty much has the same features as AvalonEdit, and I like this one as well. I actually used ICSharp Code editor in an app I made, and was pretty satisfied with the features.

As far as I know, both of these controls are very efficient, and would be better than just a richtextbox.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top