private static bool TryGetPropertyPathTarget(DependencyObject root, PropertyPath propertyPath, out DependencyObject target, out DependencyProperty targetProperty) { object baseValue; target = propertyPath.Elements.Count() > 1 && propertyPath.GetBasePropertyPath().TryGetValue(root, out baseValue) ? baseValue as DependencyObject : root; if (target != null && !propertyPath.IsEmpty) { return(propertyPath.Elements.Last().TryGetDependencyProperty(target.GetType(), out targetProperty)); } target = null; targetProperty = null; return(false); }
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 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(); } }
private static bool TryGetPropertyPathTarget(DependencyObject root, PropertyPath propertyPath, out DependencyObject target, out DependencyProperty targetProperty) { object baseValue; target = propertyPath.Elements.Count() > 1 && propertyPath.GetBasePropertyPath().TryGetValue(root, out baseValue) ? baseValue as DependencyObject : root; if (target != null && !propertyPath.IsEmpty) { return propertyPath.Elements.Last().TryGetDependencyProperty(target.GetType(), out targetProperty); } target = null; targetProperty = null; return false; }