is there a way to get notification or event when a new item is added or existing is updated in a ObservableCollection . say
class Notify:INotifyPropertyChanged
{
private string userID { get; set; }
public string UserID
{
get { return userID; }
set
{
if (userID != value)
{
userID = value;
OnPropertyChanged("UserID");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
class MainClass
{
ObservableCollection<Notify> notifyme = new ObservableCollection<Notify>();
changed()
{
//logic where there is an update
}
}
when do i call changed()