So I figured out that binding a list control directly to a List<T>
doesn't work all that well (property change notification doesn't seem to work) and that BindingList<T>
should instead be used. The problem is that BindingList<T>
class is not available in Portable Library projects. I can see System.ComponentModel
in the list of namespaces, but BindingList
is not there in it, which means Portable Library projects reference a different System
assembly than normal projects. What's my way out? Do I need to roll out BindingList<T>
class of my own?
Asked
Active
Viewed 282 times
0

dotNET
- 33,414
- 24
- 162
- 251
1 Answers
0
If you need the automatic PropertyChanged
notification only on adding or deleting items from the list (not on sorting, searching, etc.), you might be satisfied with using System.Collections.ObjectModel.ObservableCollection<T>
instead of BindingList<T>
, which is definitely available in Portable Class Libraries.
For a detailed comparison of the two, see this question!
-
`ObservableCollection` doesn't work either. I digged it further and the gist of the problem is that `DataGridView` (the control that I'm binding my collection to) does not listen to `PropertyChanged` notifications. A `BindingList` listens to these notifications and thereupon raises `ListChanged` event, which DataGridView listens to and updates itself accordingly. I went ahead and tried implementing `IBindingList` on my collection, but it looks like even that is not available in PCLs. :( – dotNET Mar 30 '15 at 05:20