public DependencyPropertyObserver(DependencyProperty dependencyProperty) { this.dependencyProperty = dependencyProperty; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); }
public TestExpression(object value, bool isReadOnly = false) { observableValue = new ObservableValue(value); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); this.isReadOnly = isReadOnly; }
public IndexPropertyObserver(Type propertyContainingType, IndexPropertyPathElement propertyPathElement, XamlNamespaces namespaces) { baseObserver = CreateBaseObserver(propertyContainingType, propertyPathElement.PropertyName); PropertyInfo indexPropertyInfo = baseObserver != null?baseObserver.ValueType.GetDefaultIndexProperty() : propertyPathElement.PropertyName.IsEmpty ? propertyContainingType.GetDefaultIndexProperty() : propertyContainingType.GetInstanceProperty(propertyPathElement.PropertyName.MemberName); if (indexPropertyInfo == null) { throw new Granular.Exception("Property \"{0}.{1}\" does not have an indexer", propertyContainingType.Name, propertyPathElement.PropertyName.MemberName); } if (indexPropertyInfo.GetIndexParameters().Count() != propertyPathElement.IndexRawValues.Count()) { throw new Granular.Exception("Invalid number of index parameters for \"{0}.{1}\"", indexPropertyInfo.DeclaringType.Name, indexPropertyInfo.Name); } indexerObserver = new ClrPropertyObserver(indexPropertyInfo, propertyPathElement.ParseIndexValues(indexPropertyInfo)); indexerObserver.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); if (baseObserver != null) { baseObserver.ValueChanged += (sender, e) => indexerObserver.SetBaseValue(baseObserver.Value); indexerObserver.SetBaseValue(baseObserver.Value); } }
public ValueOverlapExpression() { values = new List <Tuple <object, object> >(); observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, oldValue, newValue) => ValueChanged.Raise(this, oldValue, newValue); }
private void NotifyObject_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == _propertyName) { ValueChanged.Raise(this, EventArgs.Empty); } }
public void NotifyValueChange(string propName, object newValue) { try { ValueChanged.Raise(this, new ValueChangeEventArgs(propName, newValue)); } catch (Exception ex) { Debug.WriteLine(propName + ";" + newValue + ";" + ex.ToString()); } }
private void OnTargetValueChanged(object sender, ObservableValueChangedArgs e) { if (UpdateSourceTrigger == UpdateSourceTrigger.Default && isSourceUpdateMode) { UpdateSourceOnTargetChanged(); } ValueChanged.Raise(this, e); }
private void OnTargetValueChanged(object sender, object oldValue, object newValue) { if (UpdateSourceTrigger == UpdateSourceTrigger.Default && isSourceUpdateMode) { UpdateSourceOnTargetChanged(); } ValueChanged.Raise(this, oldValue, newValue); }
public ClrPropertyObserver(PropertyInfo propertyInfo, IEnumerable <object> index) { this.propertyInfo = propertyInfo; this.propertyGetMethod = propertyInfo.GetGetMethod(); this.propertySetMethod = propertyInfo.GetSetMethod(); this.index = index; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); }
/// <summary> /// Raises the <see cref="ValueChanged"/> event, and passes changes onto the next expression part in the chain. /// </summary> protected virtual void OnValueChanged() { ValueChanged.Raise(this, EventArgs.Empty); if (_nextPart != null) { //if the value of this PropertyExpressionPart changes, we need to update the Object in the next PropertyExpressionPart with the new value _nextPart.Object = Value; } }
public ResourceReferenceExpression(IResourceContainer resourceContainer, object resourceKey) { this.resourceContainer = resourceContainer; this.resourceKey = resourceKey; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, oldValue, newValue) => ValueChanged.Raise(this, oldValue, newValue); observableValue.BaseValue = GetResourceValue(); resourceContainer.ResourcesChanged += OnResourcesChanged; }
public ContextSourceObserver(DependencyObject target, object baseValue) { this.target = target; observableValue = new ObservableValue(baseValue); observableValue.ValueChanged += (sender, oldValue, newValue) => ValueChanged.Raise(this, oldValue, newValue); if (target is IContextElement) { ((IContextElement)target).ContextParentChanged += OnTargetContextParentChanged; } }
public CoercedDependencyPropertyValueEntry(IDependencyPropertyValueEntry source, DependencyObject dependencyObject, CoerceValueCallback coerceValueCallback) { this.source = source; this.dependencyObject = dependencyObject; this.coerceValueCallback = coerceValueCallback; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); source.ValueChanged += (sender, e) => CoerceValue(); CoerceValue(); }
private void OnValueChanged(int newValuePriority, object newValue) { if (ValuePriority > newValuePriority) // a higher priority value is hiding the new value { if (baseValuePriority <= newValuePriority && newValuePriority <= BaseValueHighestPriority) { baseValuePriority = BaseValueHighestPriority + 1; // invalidate baseValuePriority } return; } object oldValue = Value; bool isNewValueValid = IsValueValid(newValue); if (ValuePriority == newValuePriority && isNewValueValid && coerceValueCallback == null) { Value = newValue; ValueChanged.Raise(this, new DependencyPropertyChangedEventArgs(dependencyProperty, oldValue, newValue)); // since this was already the value priority and there is no coercion, Value must have been changed here return; } if (ValuePriority < newValuePriority && !isNewValueValid) // a higher priority value was changed but it's not valid, so it can be ignored { return; } while (!isNewValueValid && newValuePriority > 0) // try to find the highest priority value that is valid { newValuePriority--; newValue = GetValue(newValuePriority, true); isNewValueValid = IsValueValid(newValue); } if (ValuePriority != newValuePriority) { ValuePriority = newValuePriority; baseValuePriority = newValuePriority; // possible invalidation of baseValuePriority } if (coerceValueCallback != null) { newValue = coerceValueCallback(dependencyObject, newValue); } if (Granular.Compatibility.EqualityComparer.Default.Equals(oldValue, newValue)) { return; } Value = newValue; ValueChanged.Raise(this, new DependencyPropertyChangedEventArgs(dependencyProperty, oldValue, newValue)); }
public AnimationExpression(DependencyObject dependencyObject, DependencyProperty dependencyProperty) { this.dependencyObject = dependencyObject; this.dependencyProperty = dependencyProperty; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); layers = new AnimationLayerCollection(); layers.LayerInvalidated += OnLayerInvalidated; SetAnimationValue(); }
public DataContextSourceObserver(DependencyObject target) { this.target = target; frameworkElementValue = new ObservableValue(GetFrameworkElementAncestor(target)); frameworkElementValue.ValueChanged += (sender, oldValue, newValue) => dataContextValue.SetBaseValue(newValue); dataContextValue = new DependencyPropertyObserver(FrameworkElement.DataContextProperty); dataContextValue.SetBaseValue(frameworkElementValue.Value); dataContextValue.ValueChanged += (sender, oldValue, newValue) => ValueChanged.Raise(this, oldValue, newValue); if (target is IContextElement) { ((IContextElement)target).ContextParentChanged += OnTargetContextParentChanged; } }
public void CoerceValue() { if (coerceValueCallback == null) { return; } object oldValue = Value; object newValue = coerceValueCallback(dependencyObject, GetValue(ValuePriority, true)); if (Granular.Compatibility.EqualityComparer.Default.Equals(oldValue, newValue)) { return; } Value = newValue; ValueChanged.Raise(this, new DependencyPropertyChangedEventArgs(dependencyProperty, oldValue, newValue)); }
public DependencyPropertyValueEntry(DependencyObject dependencyObject, DependencyProperty dependencyProperty) { this.dependencyProperty = dependencyProperty; this.defaultValue = dependencyProperty.GetMetadata(dependencyObject.GetType()).DefaultValue; observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); baseValues = new object[BaseValuePriorities]; for (int i = 0; i < baseValues.Length; i++) { baseValues[i] = ObservableValue.UnsetValue; } currentValue = ObservableValue.UnsetValue; animationValue = ObservableValue.UnsetValue; }
public ObservableExpression(object baseValue, PropertyPath propertyPath) { observableValue = new ObservableValue(); observableValue.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); if (propertyPath.IsEmpty) { observableValue.Value = baseValue; ValueType = baseValue != null?baseValue.GetType() : null; } else { propertyPathElement = propertyPath.Elements.Last(); baseObserver = new ObservableExpression(baseValue, propertyPath.GetBasePropertyPath()); baseObserver.ValueChanged += (sender, e) => SetDelegateObserverBaseValue(); SetDelegateObserverBaseValue(); } }
public void NotifyValueChanged(string name, object value) { ValueChanged.Raise(this, new ValueChangeEventArgs(name, value)); }
/// <summary> /// Raises the <see cref="E:Sce.Atf.Controls.NumericTupleControl.ValueChanged"/> event</summary> /// <param name="e">Event args</param> protected virtual void OnValueChanged(EventArgs e) { ValueChanged.Raise(this, e); }
private void OnObservableValueChanged(object sender, ObservableValueChangedArgs e) { ValueChanged.Raise(this, e); }
/// <summary> /// Raises this object's <see cref="ValueChanged"/> event /// </summary> /// <param name="e"></param> protected void OnValueChanged(ValueChangedEventArgs e) { ValueChanged.Raise(this, e); }
public ReadOnlyObservableValue(IObservableValue source) { this.source = source; source.ValueChanged += (sender, e) => ValueChanged.Raise(this, e); }
/// <summary> /// Raises the ValueChanged event and performs custom processing</summary> protected virtual void OnValueChanged() { ValueChanged.Raise(this, EventArgs.Empty); }
/// <summary> /// Helper function to raise the value changed event /// </summary> public virtual void NotifyValueChanged(string MemberName, object _value) { //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); }
private void OnPropertyValueChanged(object sender, EventArgs e) { ValueChanged.Raise(this, EventArgs.Empty); }
void m_editControl_ValueChanged(object sender, EventArgs e) { ValueChanged.Raise(this, e); }
public virtual void NotifyValueChanged(string MemberName, object _value) { ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); }
private void OnBaseObservableValueChanged(object sender, object oldValue, object newValue) { Value = newValue; ValueChanged.Raise(this, oldValue, newValue); }