I'm working with an observable collection of a Job
class I have defined. I have binded a method to handle the INotifyCollectionChanged
event. MSDN tells me that INotifyCollectionChanged
is a "listener of dynamic changes, such as when items get added and removed or the whole list is refreshed," but I'd like to listen for changes to properties to any of the job classes in the collection, is there an event handler for this?? I understand there is an INotifyPropertyChanged
interface but I want this to work on a collection.
EDIT:
I'm confused by this to be honest so I should give more background info to what I'm doing so I can get my answer. I have this property in a 'Job' class:
public Boolean IsPlanned
{
get
{
return this.Storage<Job>().isPlanned;
}
set
{
var storage = this.Storage<Job>();
if (storage.isPlanned != value)
{
storage.isPlanned = value;
this.OnPropertyChanged(() => this.isPlanned);
MessageBox.Show("IsPlanned property was changed on one of the jobs " + this.Subject);
}
}
}
This job class actually inherits from a telerik control's appointment class (which just so happens to implement INotifyPropertyChanged). From telerik documentation I also got the above code (minus the messagebox). Now when I'm changing this boolean ONCE, that message box line is bein executed 5 times.
Any help appreciated!!
EDIT 2: Paths were IsPlanned is changed:
PresentationManager.Instance.AllJobs.Single(o => o.JobGuid.Equals(((Job)state.DraggedAppointments.First()).JobGuid)).IsPlanned = true;
PresentationManager.Instance.AllJobs.Single(o => o.JobGuid.Equals(((Job)payload.DraggedAppointments.First()).JobGuid)).IsPlanned = false;
These are both from different classes that are used to define override's for my custom drag drop behaviour (from listbox).
Implement the INotifyPropertyChanged interface on your
Job
class. This should then allow you to use thePropertyChanged
on yourObservableCollection<Job>
.