开发者

What is the most appropriate WPF control for showing a (color) log?

In WinForms I would use the rich text 开发者_开发技巧box to show the live output from msbuild. The performance wasn't that great with large amounts of text.

Does WPF have a better performing control? Any techniques to make it perform well?

Thanks in advance!


I would consider RichTextbox and FlowDocument. But it's also possible to get colored items in a ListBox.

Expected performance: better than in WinForms.


I would take a look at FlowDocument and FlowDocumentScrollViewer. Here is a nice FlowDocument overview. Also, take a look at this question for tips on optimizing the performance.


It depends on what you need.

If it needs to look and act like a textblock, you might need to stay with a document based thing.

But if your log is "record" based, where each log message is a "record", then a ListView might be a better use. You can style individual records in the listview differently using datatemplates, and the ListView supports virtualization, which could help with performance, at least in some ways. This would make it easier to show warnings and errors different than other things, you could use collectionviewsource for sorting and grouping, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜