Auto properties , unfortunately, do not support change notification. Therefore, the DataGrid will not know that the collection was modified if you installed source-Property.
- INotifiyPropertyChanged messagesGrid.source -Property:
class YourUserControlClass: INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) {
if (null != PropertyChanged) {
PropertyChanged(this,e);
}
}
ObservableCollection<HL7Message> m_source;
public ObservableCollection<HL7Message> Source { g
get{return m_source;}
set{
if(value != m_source){
m_source=value;
OnPropertyChanged("Source");
}
}
}
....
, source UpperCase, .net . , .
<data:DataGrid x:Name="dgMessages" Grid.Row="2" AutoGenerateColumns="True" ItemsSource="{Binding Source}" ></data:DataGrid>