Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
 private void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     foreach (UIElement child in e.NewItems)
     {
         MoveVisualChild(child, GetZIndex(child));
     }
 }
Ejemplo n.º 3
0
 public static void Raise(this NotifyCollectionChangedEventHandler handler, object sender, NotifyCollectionChangedEventArgs e)
 {
     if (handler != null)
     {
         handler(sender, e);
     }
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
            }
        }