public PropertyMountPoint(object origin, PropertyPath propertyPath) { Guard.ThrowIfNull(origin, nameof(origin)); Guard.ThrowIfNull(propertyPath, nameof(propertyPath)); this.referencedTargettedProperty = GetReferencedPropertyInfo(origin, propertyPath, 0); }
private IEnumerable<PropertyDefinition> GetSubscriptionsRecursive(object current, PropertyPath propertyPath, int i) { var subscriptions = new List<PropertyDefinition>(); var inpc = current as INotifyPropertyChanged; if (inpc == null) { return subscriptions; } var nextPropertyName = propertyPath.Chunks[i]; subscriptions.Add(new PropertyDefinition(inpc, nextPropertyName)); if (i < _propertyPath.Chunks.Length) { var currentObjectTypeInfo = current.GetType().GetTypeInfo(); var nextProperty = currentObjectTypeInfo.GetDeclaredProperty(nextPropertyName); var nextInstance = nextProperty.GetValue(current); if (i < _propertyPath.Chunks.Length - 1) { subscriptions.AddRange(GetSubscriptionsRecursive(nextInstance, propertyPath, i + 1)); } } return subscriptions; }
public XamlBindingDefinition(Control target, PerspexProperty targetProperty, PropertyPath sourcePropertyPath, BindingMode bindingMode) { _target = target; _targetProperty = targetProperty; _sourcePropertyPath = sourcePropertyPath; _bindingMode = bindingMode; }
public ObservablePropertyBranch(object root, PropertyPath propertyPath) { Guard.ThrowIfNull(root, nameof(root)); Guard.ThrowIfNull(propertyPath, nameof(propertyPath)); this.root = root; this.propertyPath = propertyPath; this.mountPoint = new PropertyMountPoint(root, propertyPath); var subscriptions = this.GetInpcNodes(); this.Changed = this.CreateObservableFromNodes(subscriptions); }
public ObservablePropertyBranch(object instance, PropertyPath propertyPath) { Guard.ThrowIfNull(instance, nameof(instance)); Guard.ThrowIfNull(propertyPath, nameof(propertyPath)); _instance = instance; _propertyPath = propertyPath; _mountPoint = new PropertyMountPoint(instance, propertyPath); var properties = GetPropertiesThatRaiseNotifications(); Values = CreateUnifiedObservableFromNodes(properties); }
private static TargettedProperty GetReferencedPropertyInfo(object current, PropertyPath propertyPath, int level) { var typeInfo = current.GetType().GetTypeInfo(); var leftPropertyInfo = typeInfo.GetDeclaredProperty(propertyPath.Chunks[level]); if (level == propertyPath.Chunks.Length - 1) { return new TargettedProperty(current, leftPropertyInfo); } var nextInstance = leftPropertyInfo.GetValue(current); return GetReferencedPropertyInfo(nextInstance, propertyPath, level + 1); }
public BindingSource(PropertyPath sourcePropertyPath, object source) { _sourcePropertyPath = sourcePropertyPath; _source = source; }
public BindingDefinitionBuilder() { _bindingMode = BindingMode.Default; _sourcePropertyPath = new PropertyPath(string.Empty); }