protected override bool InternalCanCreateInstance(ISceneInsertionPoint insertionPoint) { if (!this.IsInsertionPointValid(insertionPoint)) { return(false); } SceneNode sceneNode = insertionPoint.SceneNode; DocumentNodePath documentNodePath = sceneNode.DocumentNodePath; DocumentNode nodeBeingLookedFor = new ExpressionEvaluator(sceneNode.ViewModel.DocumentRootResolver).EvaluateResource(documentNodePath, this.ResourceModel.KeyNode); return(!documentNodePath.Contains(nodeBeingLookedFor)); }
public static bool ShouldSetEditingContextToNodePath(DocumentNodePath valuePath, SceneElement targetElement, ReferenceStep targetProperty) { if (valuePath != null) { DocumentNode node = valuePath.Node; if (node != null && (PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)node.Type) || PlatformTypes.Style.IsAssignableFrom((ITypeId)node.Type) && node is DocumentCompositeNode && (!targetProperty.Equals((object)BaseFrameworkElement.StyleProperty) || !PlatformTypes.Style.IsAssignableFrom((ITypeId)targetElement.Type))) && !ControlStylingOperations.IsInsideDefaultStyleOrTemplate(valuePath)) { DocumentNodePath containerOwnerPath = valuePath.GetContainerOwnerPath(); if (!valuePath.IsValid()) { return(false); } if (containerOwnerPath != null) { return(!containerOwnerPath.Contains(valuePath.Node)); } return(true); } } return(false); }