public bool MoveNext() { if (this.endOfAncestorChain) { return(false); } if (this.moveTo != null) { this.current = this.moveTo; this.moveTo = (DataBindingProcessor.DataContextWalker.ContextLocation)null; return(true); } if (this.MoveNextInternal(ref this.current)) { return(true); } this.Reset(); this.endOfAncestorChain = true; return(false); }
private bool MoveNextInternal(ref DataBindingProcessor.DataContextWalker.ContextLocation location) { if (location == null) { location = new DataBindingProcessor.DataContextWalker.ContextLocation(this.first.Context, this.first.Property); return(true); } if (location.Context.ParentContext != null) { DataBindingProcessingContext parentContext = location.Context.ParentContext; location = new DataBindingProcessor.DataContextWalker.ContextLocation(parentContext, location.Context.Property); } else { if (location.Context.OuterContext == null) { return(false); } DataBindingProcessingContext outerContext = location.Context.OuterContext; location = new DataBindingProcessor.DataContextWalker.ContextLocation(outerContext, outerContext.Property); } return(true); }
public bool MoveTo(DocumentCompositeNode targetNode, IProperty targetProperty, bool makeCurrent) { this.endOfAncestorChain = false; this.moveTo = (DataBindingProcessor.DataContextWalker.ContextLocation)null; if (this.CurrentNode == targetNode) { this.moveTo = new DataBindingProcessor.DataContextWalker.ContextLocation(this.CurrentContext, targetProperty); } else { DataBindingProcessingContext context; if (this.namedElementDataContexts.TryGetValue(targetNode, out context)) { this.moveTo = new DataBindingProcessor.DataContextWalker.ContextLocation(context, targetProperty); } } if (this.moveTo == null) { this.moveTo = this.current == null || this.current.Node == null ? new DataBindingProcessor.DataContextWalker.ContextLocation(this.first.Context, this.first.Property) : new DataBindingProcessor.DataContextWalker.ContextLocation(this.current.Context, this.current.Property); while (this.moveTo.Node != targetNode) { if (!this.MoveNextInternal(ref this.moveTo)) { this.Reset(); this.endOfAncestorChain = true; return(false); } } this.moveTo = new DataBindingProcessor.DataContextWalker.ContextLocation(this.moveTo.Context, targetProperty); } if (makeCurrent) { return(this.MoveNext()); } return(true); }
public void Reset() { this.endOfAncestorChain = false; this.moveTo = (DataBindingProcessor.DataContextWalker.ContextLocation)null; this.current = (DataBindingProcessor.DataContextWalker.ContextLocation)null; }
public DataContextWalker(DataBindingProcessingContext context, IProperty property, Dictionary <DocumentCompositeNode, DataBindingProcessingContext> namedElementDataContexts) { this.namedElementDataContexts = namedElementDataContexts; this.current = this.first = new DataBindingProcessor.DataContextWalker.ContextLocation(context, property); }