Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
UltraWinGrid DataBinding - INotifyPropertyChanged and IBindingList
posted

Hi All,

Is there anyway to have the grid only refresh the cells that have changed in a row? Or, to be more specific, is there anyway to ask the grid to handle column level changes on rows (e.g. Row.PropertyChanged insteald of RowChanged)?

We have a wingrid bound to a custom collection which implements IBindingList. The grid refreshes/repaint the rows properly when the ListChangedType.Replace is raised.

However the grid appears to be calling all getters of all the visible columns whenever a row changed event is raised. But in practice only one or two properties are changed per row per update.

The items in our IBindingList all implement INotifyPropertyChanged and also raises events as updates come in however the grid doesnt appear to be listening to these.

There are two things on our wishlist:

1. Grid only repaint the cells changed - this would save us a great deal in performance (both painting and calling all property getters) but the grid appears to be repainting the whole visible row - think about 100 changes per second, our application has roughly 80+ columns (yes, they have very large monitors and very good eyes).

2. Grid sort to take the changed columns into account - currently the UltraWinGrid sorting suffers signficantly when number of rows grow beyond hundreds (we have 10 ~ 15k and the requirement is to have sorting on ticking columns), partly due to the fact that the grid appears to be trying to resort the whole thing whenever a change comes in, and in an ideal sorting method the sorting should only be refreshed when columns included in the sort descriptors have changed.

Please let me know if I have missed anything obvious...

Thanks,

LD.

  • 469350
    Suggested Answer
    Offline posted

    Hi LD,

    No, there's no way the grid can only respond to INotifyPropertyChange instead of the IBindingList and IList notifications.

    Do I understand correctly that you are displaying 10 to 15 thousand rows at once? If so... why display that much data? It can't possibly be useful to any human user to have that much data displayed at once, can it? You may want to considering filtering the data, at least for display purposes, to something more managable to the user.

    The grid is heavily reliant on the underlying data source and if calling a property getter on that data source is inefficient, then that could certainly cause a performance problem. Have you read the WinGrid Performance Guide?

    Anyway, regarding sorting, the grid does not automatically re-sort when the data changes. This is intentional, because you may not want a row to move when the user edits a cell, for example. So.. if the grid is re-sorting the entire set of data every time a value changes, something in your code is probably calling the Refresh method on the SortedColumns collection of the band. Instead of doing that, what you can do is call RefreshSortPosition on the individual row. This method assumes that the grid data is already sorted for the most part and the it just needs to shift the one row into it's proper place.