w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Limit binding updates per second

This isn't a complete answer, but something to note:

I see that you're doing NotifyPropertyChanged("dataItems") from within your CollectionChanged handler. I don't think you want to do this, and it may be causing a performance issue. dataItems appears to be a property that is of type ObservableCollection<T>. When the collection is changed, the collection itself sends a CollectionChanged event. In your UI, an ItemsControl (ComboBox, ListBox, etc) is probably bound to the dataItems property. When the collection raises its CollectionChanged event, you cannot guarantee the order in which the event handlers will be called. If your UI handles the event first, it may try to allocate/deallocate the containers and UI elements for the new/old items in your collection. When you manually call NotifyPropertyChanged("dataItems"), the UI may discard all UI elements and reconstruct them (depending on whether the UI element is smart enough to recognize that the value hasn't changed, and also depending on the container recycling logic). This is (obviously) inefficient. Don't ever send PropertyChanged notifications unless the returned value/object of the property changes.

Make this change and let us know if there is any significant impact.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.