KeyedCollection Support Two-Way DataBinding?

I want my business object collections to inherit from a generic collection that supports access to its members by key and/or numeric index. It appears that KeyedCollection meets this requirement but it is my understanding that the only the BindingList<> generic supports two-way databinding

Is this true Or does the KeyedCollection type support two-way databinding as well I realize that I could probably implement the interfaces myself but I would rather have that functionality inherited if possible

Thanks for any assistance.

Mark



Answer this question

KeyedCollection Support Two-Way DataBinding?

  • HavingProblems

    You can use the BindingSource component to perform two-way databinding with a KeyedCollection. Once you've created your derived KeyedCollection, make sure you've built the project, then add a BindingSource to your form, and in its DataSource property dropdown click the "Add Project DataSource" link, choose "Object" from the first wizard page, then select your KeyedCollection class on the next page. Then bind your controls to the BindingSource and you will have two-way data-binding to the collection.

    If you need any extra help with that, let me know and I can provide an example.



  • MelissaA

    Thanks. I'll give that a shot.
  • KeyedCollection Support Two-Way DataBinding?