I am working on a project in WPF using the MVVM Light framework. I have a DataGrid
that is bound to an ObservableCollection<Worker>
. As of now, when I add a new item, the DataGrid
doesn't update and I believe it is because the setter never fires.
public ObservableCollection<Worker> MasterWorkerList
{
get { return _masterWorkerList; }
set
{
System.Windows.MessageBox.Show("Firing");
_masterWorkerList = value;
RaisePropertyChanged(() => MasterWorkerList);
}
}
The messagebox never displays, even when I call this:
DataManager.Data.MasterWorkerList.Add(_create.NewWorker());
How can I get RaisePropertyChanged
to fire so I can update the UI?
I've tried using the solutions in this post to no avail: ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged)
Any advice would be appreciated. If you need more of my code, please let me know.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…