Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a fast way to render a log view in WPF?

Tags:

c#

wpf

I'm writing an application that needs a log-like view, (similar to how an IM client displays messages in the conversation), with potentially many updates per second. Speed is an issue here; the application locking up due to a large number of incoming events is a possible problem. I need selection and basic text formatting, so manual rendering could get quite complex, I'd like to avoid it if possible. I'd also like to bottom-anchor the scroll bar, that is, if it's at the bottom, stay at the bottom when the new item is added. What would be a good way to implement this?

like image 863
Eric Avatar asked Jan 29 '26 04:01

Eric


1 Answers

You can implement it very easily in WPF.

  1. Create an ObservableCollection of Log entities and bind to a ListBox.
  2. Give a DataTemplate for the ListBox.ItemTemplate.

*When running in real time you need either UI side or Data side virtualization Check out my PaginatedObservableCollection so that the DataVirtualization will automatically function.

like image 107
Jobi Joy Avatar answered Jan 31 '26 16:01

Jobi Joy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!