To make the DataGrid refresh automatically when the property values of data items in the data source are changed, the data item should implement the INotifyPropertyChanged interface. The collection does no need to notify property change at all. For example:
class SomeClass:INotifyPropertyChanged
{
public event PropertyChangedEventHanlder PropertyChanged;
private void OnPropertyChanged(string prop)
{
if(PropertyChanged!=null)
{
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
}
private string name;
public string Name
{
get {return name;}
set
{
if(name!=value)
{
name=value;
OnPropertyChanged("Name");
}
}
}
}
{
public event PropertyChangedEventHanlder PropertyChanged;
private void OnPropertyChanged(string prop)
{
if(PropertyChanged!=null)
{
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
}
private string name;
public string Name
{
get {return name;}
set
{
if(name!=value)
{
name=value;
OnPropertyChanged("Name");
}
}
}
}
Hope this helps.