public static DocumentNode FindNamedElement(DocumentNode behaviorNode, string elementName) { if (!string.IsNullOrEmpty(elementName)) { DocumentNodeNameScope containingNameScope = behaviorNode.FindContainingNameScope(); if (containingNameScope == null) { return((DocumentNode)null); } DocumentNode node = containingNameScope.FindNode(elementName); if (node != null) { return(node); } } else { if (ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)behaviorNode.Type)) { return(BehaviorHelper.ValidateNodeTypeAndGetParent(BehaviorHelper.ValidateNodeTypeAndGetParent(BehaviorHelper.ValidateNodeTypeAndGetParent((DocumentNode)behaviorNode.Parent, ProjectNeutralTypes.BehaviorTriggerActionCollection), ProjectNeutralTypes.BehaviorTriggerBase), ProjectNeutralTypes.BehaviorTriggerCollection)); } if (ProjectNeutralTypes.BehaviorTriggerBase.IsAssignableFrom((ITypeId)behaviorNode.Type)) { return(BehaviorHelper.ValidateNodeTypeAndGetParent((DocumentNode)behaviorNode.Parent, ProjectNeutralTypes.BehaviorTriggerCollection)); } } return((DocumentNode)null); }
private static ElementDataSourceInfo GetElementNameBinding(DocumentCompositeNode bindingNode) { DocumentNode node = bindingNode.Properties[BindingSceneNode.ElementNameProperty]; if (node == null) { return((ElementDataSourceInfo)null); } string valueAsString = DocumentPrimitiveNode.GetValueAsString(node); if (string.IsNullOrEmpty(valueAsString)) { return(ElementDataSourceInfo.Invalid); } DocumentCompositeNode namedElement = node.FindContainingNameScope().FindNode(valueAsString) as DocumentCompositeNode; if (namedElement == null) { return(ElementDataSourceInfo.Invalid); } string bindingPath = DataContextHelper.GetBindingPath(bindingNode); return(new ElementDataSourceInfo(namedElement, bindingPath)); }
private bool AppliesToImpl(DocumentNode node) { DocumentNodeNameScope documentNodeNameScope = node.NameScope != null ? node.NameScope : node.FindContainingNameScope(); if (this.ReferentialType.IsAssignableFrom((ITypeId)node.Type) && documentNodeNameScope.Equals((object)this.NameChangeModel.NameScope)) { return(((DocumentCompositeNode)node).GetValueAsString(this.ReferentialProperty) == this.NameChangeModel.OldReferenceValue); } return(false); }
public static DocumentNode FindByName(DocumentNode node, string name) { return((node.NameScope != null ? node.NameScope : node.FindContainingNameScope()).FindNode(name)); }
public override sealed bool Verify(DocumentNode node) { string nameToValidate = this.GetNameToValidate((DocumentCompositeNode)node); return(!string.IsNullOrEmpty(nameToValidate) && node.FindContainingNameScope().FindNode(nameToValidate) != null); }