public CompositePathGetter ( IEnumerable <IBindingPathLink <object> > pathLinks, PropertyType defaultValue ) { _pathLinks = pathLinks; _defaultValue = defaultValue; if (pathLinks.IsNullOrEmpty()) { PropGetters.Add(new SimplePropGetter <object>()); return; } IObjWithPropGetter <object> previousPropGetter = null; foreach (var pathLink in _pathLinks) { IObjWithPropGetter <object> propGetter = pathLink.CreateGetter(); PropGetters.Add(propGetter); if (previousPropGetter != null) { IObjWithPropGetter <object> thePreviousPropGetter = previousPropGetter; previousPropGetter.PropertyChangedEvent += () => { propGetter.TheObj = thePreviousPropGetter.GetPropValue(); }; } previousPropGetter = propGetter; } previousPropGetter.PropertyChangedEvent += () => { if (this.PropertyChangedEvent == null) { return; } if (!LastPropGetter.HasObj) { _cachedValue.TheValue = _defaultValue; } else { _cachedValue.TheValue = (PropertyType)LastPropGetter.GetPropValue(); } PropertyChangedEvent?.Invoke(); }; }
public void Addiere(Aufgabe a) { // Aufgaben.Add(a); böse Aufgaben.Add(new Aufgabe { Text = a.Text, ID = Aufgaben.Count }); PropertyChangedEvent.Invoke(this, EventArgs.Empty); }
protected virtual void OnRaisePropertyChanged <T>(string propertyName, T previousValue, T actualValue) { var action = new Action <string, T, T>((pro, pre, act) => { PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(pro)); PropertyChanged?.Invoke(this as TNotifier, new NotifierPropertyChangedEventArgs <TNotifier>(pro, (TNotifier)(INotifier <TNotifier>) this, pre, act)); }); if (UseSynchronizerOnRaisePropertyChanged && Synchronizer != null) { Synchronizer.Invoke(action, propertyName, previousValue, actualValue).Wait(); } else { action(propertyName, previousValue, actualValue); } }
public void TriggerPropertyChanged() { PropertyChangedEvent?.Invoke(); }
protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
private void ModifyEnum(int value) { OnValueChanged.Invoke(value, path); }
public void PropertyChanged() { PropertyChangedEvent?.Invoke(this, EventArgs.Empty); }
protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChangedEvent?.Invoke(propertyName); }
protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }