c# - How to bind to all elements in a BindingList? -
i have bindinglist consisting of objects of class implements inotifypropertychanged.
public myclass : inotifypropertychanged { // ... } var element1 = new myclass(); var element2 = new myclass(); var mybindinglist = new bindinglist<myclass> {element1, element2}; i'd notified every time 1 of elements in list changed , run method. how can bind elements in list?
i have solved following way:
foreach (myclass myclass in mybindinglist) { myclass.propertychanged += myclassonpropertychanged; } private void myclassonpropertychanged(object sender, propertychangedeventargs propertychangedeventargs) { // ... }
Comments
Post a Comment