Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This uses the above ideas but makes it a derived 'more sensitive' collection:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Collections; namespace somethingelse { public class ObservableCollectionEx&lt;T&gt; : ObservableCollection&lt;T&gt; where T : INotifyPropertyChanged { // this collection also reacts to changes in its components' properties public ObservableCollectionEx() : base() { this.CollectionChanged +=new System.Collections.Specialized.NotifyCollectionChangedEventHandler(ObservableCollectionEx_CollectionChanged); } void ObservableCollectionEx_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Remove) { foreach(T item in e.OldItems) { //Removed items item.PropertyChanged -= EntityViewModelPropertyChanged; } } else if (e.Action == NotifyCollectionChangedAction.Add) { foreach(T item in e.NewItems) { //Added items item.PropertyChanged += EntityViewModelPropertyChanged; } } } public void EntityViewModelPropertyChanged(object sender, PropertyChangedEventArgs e) { //This will get called when the property of an object inside the collection changes - note you must make it a 'reset' - dunno why NotifyCollectionChangedEventArgs args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset); OnCollectionChanged(args); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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