Ejemplo n.º 1
0
        public void Move(int oldIndex, int newIndex)
        {
            if (HasItems && MathEx.IsWithin(oldIndex, 0, Count - 1))
            {
                T item = list[oldIndex];
                list.RemoveAt(oldIndex);
                list.Insert(newIndex, item);

                RaiseCollectionChanged(
                    new NotifyCollectionChangedEventArgs(
                        NotifyCollectionChangedAction.Move,
                        item, newIndex, oldIndex));

                OnItmesCountChanged();
            }
        }
Ejemplo n.º 2
0
        public void RemoveAt(int index)
        {
            int oldCount = list.Count;

            if (HasItems && MathEx.IsWithin(index, 0, oldCount - 1))
            {
                T item = list[index];
                list.RemoveAt(index);

                if (oldCount != Count)
                {
                    RaiseCollectionChanged(
                        new NotifyCollectionChangedEventArgs(
                            NotifyCollectionChangedAction.Remove, item, index));

                    OnItmesCountChanged();
                }
            }
        }
Ejemplo n.º 3
0
 public static bool CanItemIndexIncrement <T>(this NotifiableCollection <T> collection, int currentIndex, int downCount = 1)
 {
     return(MathEx.IsWithin(currentIndex, 0, collection.Count - (1 + downCount)));
 }
Ejemplo n.º 4
0
 public static bool CanItemIndexDecrement <T>(this NotifiableCollection <T> collection, int currentIndex, int count)
 {
     return(MathEx.IsWithin(currentIndex, count, collection.Count - 1));
 }
Ejemplo n.º 5
0
 public bool CanItemIndexIncrement(int currentIndex, int downCount = 1)
 {
     return(MathEx.IsWithin(currentIndex, 0, Count - (1 + downCount)));
 }
Ejemplo n.º 6
0
 public bool CanItemIndexDecrement(int currentIndex, int count)
 {
     return(MathEx.IsWithin(currentIndex, count, Count - 1));
 }