Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Observable collections implement <code>INofityCollectionChanged</code> which is used by WPF to refresh the collection of view items.</p> <p>However, for the status to be updated you need your data to implement <code>INotifyPropertyChanged</code>.</p> <ul> <li>Each class you want to appear within the view must implement it, so WPF will know when its properties change and which of its properties has changed.</li> </ul> <p>The implementation is simple...</p> <pre><code>// Should implement INotifyPropertyChanged if the dictionary itself // can be changed and not only its items public class CustomClass { ObservableDictionary sub1item; // Bunch of properties and methods in this class // INotify not implemented } public class InnerClass : INotifyProperyChanged { // Bunch of properties and methods in this class // INotify not implemented public SomeEnum Status{ get{ return this.status; } } public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string propertyName) { if(PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } // where ever this.status is changed directly, // call NotifyPropertyChanged("Status") // (at end of that method) // // if this.status is changed from outside class (if public), // then add a public method NotifyStatusChanged() which calls // NotifyPropertyChanged("Status") // // If Status property has a set{} then if new value != this.status, // call NotifyPropertyChanged("Status") at end of setter } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload