문제

I'm currently working on a C#/WPF program where I'm displaying a lot of text data(replaying a text log). This runs on a timer that reads from text files and then sends the data to a User Control that will display them. The problem I'm having is that it takes more than one second to display the data that covers said second(due to the amount of data, ~11k lines pr second) in the TextBlock I'm using. If I skip the displaying part the timer/program runs just fine without any delays.

What is the best UI element to display this amount of data with in regards to update speed?

도움이 되었습니까?

해결책

With large data, you are almost always better off if you paginate the results.

This is the approach google takes with their search results. You get millions but only a fraction are on the first page.

Microsoft gives you the tools to accomplish this - FlowDocument

You can very quickly get professional looking reader style output, like a Kindle screen.

enter image description here

다른 팁

Try AvalonEdit which is great at handling large data, unlike TextBox/Block which makes UI unresponsive when dealing with large data. http://www.codeproject.com/Articles/42490/Using-AvalonEdit-WPF-Text-Editor

Are you sure users would need the entire data? You can alternatively just show the tail of logs (e.g. last 100K lines) and provide a link to download the entire text or some kind of paging mechanism.

You could create a collection of your log messages / strings / lines, and use them as the itemssource of a virtualizing panel, such as the Listbox uses it by default. Only those messages that are actually in the field of view will be rendered.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top