Software & Finance

WPF Binding - Worst Alernative Approach to Implementing INotifyPropertyChanged

There are alternate approach to implementing INotifyPropertyChanged. That would be calling the ListBox.Items.Refresh() call. It refreshes all the items in the listbox and clears out any events and styles set on each listbox item.

If you have 1000 items on the ListBox with 5 columns, if you make changes one item and one column, INotifyPropertyChanged  smartly informs the ListBox and ListBox just update the particular column of the particular item. Where as Refresh methods refreshes all the 1000 items and 5 colums, which is always a bad idea.


Refresh method is useful at the time when you want to reset all the list box items to older states. It means if you have set any events at run time for each list box items and you want to clear them out in one shot, ListBox.Items.Refresh() is the perfect way to go!