protected override void ModifyValue(PropertyReference propertyReference, object valueToSet, SceneNode.Modification modification, int index)
        {
            base.ModifyValue(propertyReference, valueToSet, modification, index);
            if (!this.IsInDocument)
            {
                return;
            }
            SceneNode sourceNode = (SceneNode)null;
            bool      flag       = this.IsSet(BehaviorEventTriggerBaseNode.BehaviorSourceObjectProperty) == PropertyState.Set;
            int       num        = (int)this.IsSet(BehaviorEventTriggerBaseNode.BehaviorSourceNameProperty);

            if (propertyReference.LastStep.Equals((object)BehaviorEventTriggerBaseNode.BehaviorSourceObjectProperty))
            {
                this.ViewModel.Document.OnUpdatedEditTransaction();
                if (modification == SceneNode.Modification.SetValue)
                {
                    sourceNode = this.ViewModel.CreateSceneNode(this.GetComputedValue(propertyReference));
                }
                else if (modification == SceneNode.Modification.ClearValue)
                {
                    sourceNode = BehaviorHelper.FindNamedElement((SceneNode)this, this.SourceName);
                }
            }
            else if (!flag && propertyReference.LastStep.Equals((object)BehaviorEventTriggerBaseNode.BehaviorSourceNameProperty))
            {
                sourceNode = BehaviorHelper.FindNamedElement((SceneNode)this, valueToSet as string);
            }
            BehaviorEventTriggerNode.FixUpEventNameImpl(this, sourceNode);
        }
示例#2
0
 public static SceneNode FindTargetElement(BehaviorTargetedTriggerActionNode goToStateNode)
 {
     if (!string.IsNullOrEmpty(goToStateNode.TargetName))
     {
         return(BehaviorHelper.FindNamedElement((SceneNode)goToStateNode, goToStateNode.TargetName));
     }
     return(goToStateNode.ViewModel.ActiveEditingContainer);
 }
示例#3
0
        public static DocumentNode FindTargetElement(DocumentNode node, bool resolveTargetName)
        {
            DocumentCompositeNode documentCompositeNode1 = node as DocumentCompositeNode;

            if (documentCompositeNode1 != null)
            {
                DocumentNode documentNode1 = documentCompositeNode1.Properties[BehaviorTargetedTriggerActionNode.BehaviorTargetNameProperty];
                string       elementName   = !resolveTargetName || documentNode1 == null || !DocumentNodeUtilities.IsResource(documentNode1) ? documentCompositeNode1.GetValueAsString(BehaviorTargetedTriggerActionNode.BehaviorTargetNameProperty) : DocumentPrimitiveNode.GetValueAsString(ExpressionEvaluator.EvaluateExpression(documentNode1));
                IProperty    property1     = node.PlatformMetadata.ResolveProperty(BehaviorTargetedTriggerActionNode.BehaviorTargetObjectProperty);
                if (property1 != null)
                {
                    DocumentNode documentNode2 = documentCompositeNode1.Properties[(IPropertyId)property1];
                    if (documentNode2 != null)
                    {
                        if (DocumentNodeUtilities.IsMarkupExtension(documentNode2))
                        {
                            if (!DocumentNodeUtilities.IsBinding(documentNode2) || !GoToStateActionNode.CanResolveTargetFromBinding(documentNode2))
                            {
                                return(ExpressionEvaluator.EvaluateExpression(documentNode2));
                            }
                            documentNode2 = GoToStateActionNode.ResolveTargetFromBinding(node, (DocumentCompositeNode)documentNode2);
                        }
                        return(documentNode2);
                    }
                }
                if (!string.IsNullOrEmpty(elementName))
                {
                    return(BehaviorHelper.FindNamedElement(node, elementName));
                }
                DocumentNode documentNode3;
                for (documentNode3 = (DocumentNode)documentCompositeNode1; documentNode3 != null; documentNode3 = (DocumentNode)documentNode3.Parent)
                {
                    DocumentCompositeNode documentCompositeNode2 = documentNode3 as DocumentCompositeNode;
                    IProperty             property2 = node.TypeResolver.ResolveProperty(VisualStateManagerSceneNode.VisualStateGroupsProperty);
                    if (property2 == null)
                    {
                        return((DocumentNode)null);
                    }
                    if (documentCompositeNode2 != null && documentCompositeNode2.Properties[(IPropertyId)property2] != null)
                    {
                        break;
                    }
                }
                if (documentNode3 != null)
                {
                    DocumentCompositeNode parent = documentNode3.Parent;
                    if (parent != null && PlatformTypes.ICollection.IsAssignableFrom((ITypeId)parent.Type) && parent.Parent != null)
                    {
                        return((DocumentNode)parent.Parent);
                    }
                    return((DocumentNode)documentNode3.Parent);
                }
            }
            return((DocumentNode)null);
        }
示例#4
0
 public static SceneNode FindNamedElement(SceneNode behaviorNode, string elementName)
 {
     if (behaviorNode != null)
     {
         DocumentNode namedElement = BehaviorHelper.FindNamedElement(behaviorNode.DocumentNode, elementName);
         if (namedElement != null)
         {
             return(behaviorNode.ViewModel.GetSceneNode(namedElement));
         }
     }
     return((SceneNode)null);
 }
示例#5
0
        private static DocumentNode ResolveTargetFromBinding(DocumentNode actionNode, DocumentCompositeNode bindingNode)
        {
            string valueAsString = bindingNode.GetValueAsString(BindingSceneNode.ElementNameProperty);

            return(BehaviorHelper.FindNamedElement(actionNode, valueAsString));
        }