Beispiel #1
0
        public static void OnChildAddedHelper(SceneElement itemsControl, SceneNode child)
        {
            IProperty propertyForChild = itemsControl.GetPropertyForChild(child);

            if (propertyForChild == null || !ItemsControlElement.ItemsProperty.Equals((object)propertyForChild))
            {
                return;
            }
            ItemsControlElement.UpdateItemsSourceOnItemsChanged(itemsControl);
        }
Beispiel #2
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);
            }
        }