Пример #1
0
        public static void MoveStates(SceneElement source, SceneElement target)
        {
            if (source == null || target == null || source.ProjectContext.PlatformMetadata.IsNullType((ITypeId)source.ProjectContext.ResolveType(ProjectNeutralTypes.VisualStateManager)))
            {
                return;
            }
            IList <VisualStateGroupSceneNode> stateGroups = VisualStateManagerSceneNode.GetStateGroups((SceneNode)target);

            stateGroups.Clear();
            ISceneNodeCollection <SceneNode> collectionForProperty = source.GetCollectionForProperty(VisualStateManagerSceneNode.VisualStateGroupsProperty);
            List <VisualStateGroupSceneNode> list = new List <VisualStateGroupSceneNode>();

            foreach (SceneNode sceneNode in (IEnumerable <SceneNode>)collectionForProperty)
            {
                if (sceneNode is VisualStateGroupSceneNode)
                {
                    list.Add((VisualStateGroupSceneNode)VisualStateGroupSceneNode.Factory.Instantiate(target.ViewModel, sceneNode.DocumentNode.Clone(target.DocumentContext)));
                }
            }
            collectionForProperty.Clear();
            foreach (VisualStateGroupSceneNode stateGroupSceneNode in list)
            {
                stateGroups.Add(stateGroupSceneNode);
            }
        }
Пример #2
0
 protected override void ModifyValue(PropertyReference propertyReference, object valueToSet, SceneNode.Modification modification, int index)
 {
     if (propertyReference.FirstStep.Equals((object)TextBlockElement.TextProperty))
     {
         ISceneNodeCollection <SceneNode> collectionForProperty = this.GetCollectionForProperty(TextBlockElement.InlinesProperty);
         if (collectionForProperty != null)
         {
             collectionForProperty.Clear();
         }
     }
     base.ModifyValue(propertyReference, valueToSet, modification, index);
 }
Пример #3
0
        public static void ClearMutuallyExclusivePropertyIfNeeded(SceneElement itemsControl, PropertyReference propertyReference)
        {
            ReferenceStep firstStep = propertyReference.FirstStep;

            if (ItemsControlElement.ItemsSourceProperty.Equals((object)firstStep))
            {
                ISceneNodeCollection <SceneNode> collectionForProperty = itemsControl.GetCollectionForProperty((IPropertyId)itemsControl.DefaultContentProperty);
                if (collectionForProperty != null)
                {
                    foreach (SceneNode sceneNode in (IEnumerable <SceneNode>)collectionForProperty)
                    {
                        SceneElement element = sceneNode as SceneElement;
                        if (element != null)
                        {
                            itemsControl.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element);
                        }
                    }
                    collectionForProperty.Clear();
                }
                itemsControl.ClearValue(ItemsControlElement.ItemsProperty);
            }
            else if (ItemsControlElement.ItemsProperty.Equals((object)firstStep))
            {
                ItemsControlElement.UpdateItemsSourceOnItemsChanged(itemsControl);
            }
            else if (ItemsControlElement.ItemTemplateProperty.Equals((object)firstStep))
            {
                itemsControl.ClearValue(ItemsControlElement.DisplayMemberPathProperty);
            }
            else
            {
                if (!ItemsControlElement.DisplayMemberPathProperty.Equals((object)firstStep))
                {
                    return;
                }
                itemsControl.ClearValue(ItemsControlElement.ItemTemplateProperty);
            }
        }
Пример #4
0
 protected override void ModifyValue(PropertyReference propertyReference, object valueToSet, SceneNode.Modification modification, int index)
 {
     if (modification == SceneNode.Modification.SetValue || modification == SceneNode.Modification.InsertValue)
     {
         ReferenceStep firstStep = propertyReference.FirstStep;
         if (valueToSet is bool && (bool)valueToSet && PanelElement.IsItemsHostProperty.Equals((object)firstStep))
         {
             ISceneNodeCollection <SceneNode> collectionForProperty = this.GetCollectionForProperty(PanelElement.ChildrenProperty);
             if (collectionForProperty != null)
             {
                 foreach (SceneNode sceneNode in (IEnumerable <SceneNode>)collectionForProperty)
                 {
                     SceneElement element = sceneNode as SceneElement;
                     if (element != null)
                     {
                         this.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element);
                     }
                 }
                 collectionForProperty.Clear();
             }
         }
         else if (PanelElement.ChildrenProperty.Equals((object)firstStep))
         {
             IProperty property = this.ProjectContext.ResolveProperty(PanelElement.IsItemsHostProperty);
             if (property != null)
             {
                 object localValue = this.GetLocalValue((IPropertyId)property);
                 if (localValue != null && (bool)localValue)
                 {
                     this.ClearLocalValue((IPropertyId)property);
                 }
             }
         }
     }
     base.ModifyValue(propertyReference, valueToSet, modification, index);
 }