In the view model, I have a set of elements of type "ClassA" called "MyCollection". ClassA has the property "IsEnabled".
class MyViewModel { List<ClassA> MyCollection { get; set; } class ClassA { public bool IsEnabled { get; set; } } }
My view has a datagrid that binds to MyCollection. Each line has a button, the attribute "IsEnabled" is attached to the IsEnabled property of class A.
When the conditions in the view model change so that one specific item in the MyCollction list should be disabled, I set the IsEnabled property to false:
MyCollection[2].IsEnabled = false;
Now I want to notify the view of this change with the OnPropertyChanged event, but I do not know how to refer to a specific element in the collection.
OnPropertyChanged("MyCollection"); OnPropertyChanged("MyCollection[2].IsEnabled");
both do not work.
How do I notify a view of this change? Thanks!
source share