/// <summary> /// Dispatches to the specific visit method for this node type. /// </summary> /// <param name="visitor">The visitor to visit this node with.</param> protected override void AcceptInternal(IExpressionVisitor visitor) { if (RelativeSourceExpression != null) { _relativeSourceExpression = AcceptWithCheck(visitor, RelativeSourceExpression, true); } }
public static IObserver CreateBindingSource(IRelativeSourceExpressionNode node, IDataContext context, [NotNull] object target, string pathEx) { if (target == null) { throw BindingExceptionManager.InvalidBindingTarget(node.Path); } string path = node.Path ?? String.Empty; if (!string.IsNullOrEmpty(pathEx)) { path = MergePath(path, pathEx); } if (node.Type != RelativeSourceExpressionNode.SelfType) { if (node.Type == RelativeSourceExpressionNode.ContextSourceType) { target = BindingServiceProvider.ContextManager.GetBindingContext(target); } else { target = new ParentSourceValue(target, node); } } return(CreateBindingSource(context, path, target, false)); }
public BindingMemberExpressionNode([NotNull] IRelativeSourceExpressionNode relativeSource, [NotNull] string paramName, int index) : this(paramName, index) { Should.NotBeNull(relativeSource, nameof(relativeSource)); _relativeSourceExpression = relativeSource; _path = relativeSource.Path; }
/// <summary> /// Initializes a new instance of the <see cref="BindingMemberExpressionNode" /> class. /// </summary> public BindingMemberExpressionNode([NotNull] IRelativeSourceExpressionNode relativeSource, [NotNull] string paramName, int index) : this(paramName, index) { Should.NotBeNull(relativeSource, "relativeSource"); _relativeSourceExpression = relativeSource; _path = relativeSource.Path; }
public ParentSourceValue(object target, IRelativeSourceExpressionNode node) { _node = node; _isElementSource = _node.Type == RelativeSourceExpressionNode.ElementSourceType; _targetReference = ServiceProvider.WeakReferenceFactory(target, true); _value = Empty.WeakReference; var rootMember = BindingServiceProvider.VisualTreeManager.GetRootMember(target.GetType()); if (rootMember != null) { _subscriber = rootMember.TryObserve(target, this); } TryHandle(null, null); }
protected override void AcceptInternal(IExpressionVisitor visitor) { if (RelativeSourceExpression != null) _relativeSourceExpression = AcceptWithCheck(visitor, RelativeSourceExpression, true); }
private IExpressionNode VisitRelativeSource(IRelativeSourceExpressionNode rs) { string memberName = rs.Type + rs.Path + rs.Level.ToString() + rs.ElementName; return(GetOrAddBindingMember(memberName, (s, i) => new BindingMemberExpressionNode(rs, s, i))); }
/// <summary> /// Initializes a new instance of the <see cref="RelativeSourceBehavior" /> class. /// </summary> public RelativeSourceBehavior(IRelativeSourceExpressionNode relativeSource) { _id = Guid.NewGuid(); _relativeSourceNode = relativeSource; }
private IExpressionNode VisitRelativeSource(IRelativeSourceExpressionNode rs) { string memberName = rs.Type + rs.Path + rs.Level.ToString() + rs.ElementName; return GetOrAddBindingMember(memberName, (s, i) => new BindingMemberExpressionNode(rs, s, i)); }