Wpf listview not updating
If you bind a List Box to an ICollection View that has one or more Property Group Descriptions in its Group Descriptions collection, the initially selected item’s Is Selected property is set to true.This might not sound like a bug, but it turned out to be one of those issues that took an hour of my life away.Now we move on to learn about working with data in our apps.What can we do when we want to work with collections of data and display that data to a user?The XAML looks like this: using a data binding to my Selected Names property.
It would be better to govern how often the binding source’s new values are pushed to the binding target. One solution is to create a value converter which governs the data flow between source and target.In my solution, I define an attached property that you attach to a List Box (or Data Grid, or anything that inherits from Multi Selector) and allows you to specify a collection (via data binding, of course) that you want to be kept in sync with the Selected Items collection of the target.To work properly, the collection you give should implement INotify Collection Changed – using Observable Collection should do the trick.Many moons ago, I asked on the WPF forums if anybody had a way of data-binding the Selected Items property of a List Box.Standard data binding doesn’t work, because the Selected Items property is read-only, and understandably so: how would you like it if I injected an arbitrary collection into your List Box and expected you to keep it up to date as the selection changed?
Search for wpf listview not updating:
As no one gave me an answer, I was forced to use my gray-matter and invent a solution of my own.