예제 #1
0
        private void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            foreach (Timeline timeline in e.OldItems)
            {
                timeline.Parent = null;
            }

            foreach (Timeline timeline in e.NewItems)
            {
                timeline.Parent = this;
            }
        }
예제 #2
0
파일: Panel.cs 프로젝트: highzion/Granular
 private void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     foreach (UIElement child in e.NewItems)
     {
         MoveVisualChild(child, GetZIndex(child));
     }
 }
예제 #3
0
 public static void Raise(this NotifyCollectionChangedEventHandler handler, object sender, NotifyCollectionChangedEventArgs e)
 {
     if (handler != null)
     {
         handler(sender, e);
     }
 }
예제 #4
0
        private void OnViewCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            int oldItemsCount = e.OldItems.Count();
            int newItemsCount = e.NewItems.Count();
            int oldContainersCount = generatedContainers.Where(container => container.Index >= e.OldStartingIndex && container.Index < e.OldStartingIndex + oldItemsCount).Count();

            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                ShiftGeneratedContainersIndex(e.NewStartingIndex, newItemsCount);
            }

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                RemoveRange(e.OldStartingIndex, oldItemsCount);
                ShiftGeneratedContainersIndex(e.OldStartingIndex, -oldItemsCount);
            }

            if (e.Action == NotifyCollectionChangedAction.Move)
            {
                SwitchGeneratedContainersIndex(e.OldStartingIndex, e.NewStartingIndex, newItemsCount);
            }

            if (e.Action == NotifyCollectionChangedAction.Replace)
            {
                RefershRange(e.NewStartingIndex, newItemsCount);
            }

            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                RemoveRange(0, ItemsCount);
            }

            ItemsChanged.Raise(this, new ItemsChangedEventArgs(e.Action, e.OldStartingIndex, e.NewStartingIndex, newItemsCount, oldContainersCount));
        }
예제 #5
0
        private void OnTriggersCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            foreach (ITrigger trigger in e.OldItems)
            {
                trigger.Detach(this, BaseValueSource.Local);

                if (trigger is DependencyObject)
                {
                    ((DependencyObject)trigger).SetInheritanceParent(null);
                }
            }

            foreach (ITrigger trigger in e.NewItems)
            {
                if (trigger is DependencyObject)
                {
                    ((DependencyObject)trigger).SetInheritanceParent(this);
                }

                trigger.Attach(this, BaseValueSource.Local);
            }
        }