// listen for changes to a property
        internal void RegisterForChanges(object item, PropertyDescriptor pd, DataBindEngine engine)
        {
            // lazy creation of the cache
            if (_table == null)
            {
                _table = new HybridDictionary();
            }

            ValueTableKey key   = new ValueTableKey(item, pd);
            object        value = _table[key];

            if (value == null)
            {
                // new entry needed - add a listener
                INotifyPropertyChanged inpc = item as INotifyPropertyChanged;
                if (inpc != null)
                {
                    PropertyChangedEventManager.AddHandler(inpc, OnPropertyChanged, pd.Name);
                }
                else
                {
                    ValueChangedEventManager.AddHandler(item, OnValueChanged, pd);
                }
            }
        }
 // Token: 0x06008DF6 RID: 36342 RVA: 0x0025AC58 File Offset: 0x00258E58
 public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd)
 {
     this._manager   = manager;
     this._source    = source;
     this._pd        = pd;
     this._eventArgs = new ValueChangedEventArgs(pd);
     pd.AddValueChanged(source, new EventHandler(this.OnValueChanged));
 }
Пример #3
0
            public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd)
            {
                // keep a strong reference to the source.  Normally we avoid this, but
                // it's OK here since its scope is exactly the same as the strong reference
                // held by the PD:  begins with pd.AddValueChanged, ends with
                // pd.RemoveValueChanged.   This ensures that we _can_ call RemoveValueChanged
                // even in cases where the source implements value-semantics (which
                // confuses the PD - see 795205).
                _manager   = manager;
                _source    = source;
                _pd        = pd;
                _eventArgs = new ValueChangedEventArgs(pd);

                pd.AddValueChanged(source, new EventHandler(OnValueChanged));
            }
            public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd) 
            {
                // keep a strong reference to the source.  Normally we avoid this, but
                // it's OK here since its scope is exactly the same as the strong reference
                // held by the PD:  begins with pd.AddValueChanged, ends with 
                // pd.RemoveValueChanged.   This ensures that we _can_ call RemoveValueChanged
                // even in cases where the source implements value-semantics (which 
                // confuses the PD - see 795205). 
                _manager = manager;
                _source = source; 
                _pd = pd;
                _eventArgs = new ValueChangedEventArgs(pd);

                pd.AddValueChanged(source, new EventHandler(OnValueChanged)); 
            }