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(); } }
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(); } } }
public static bool CanItemIndexIncrement <T>(this NotifiableCollection <T> collection, int currentIndex, int downCount = 1) { return(MathEx.IsWithin(currentIndex, 0, collection.Count - (1 + downCount))); }
public static bool CanItemIndexDecrement <T>(this NotifiableCollection <T> collection, int currentIndex, int count) { return(MathEx.IsWithin(currentIndex, count, collection.Count - 1)); }
public bool CanItemIndexIncrement(int currentIndex, int downCount = 1) { return(MathEx.IsWithin(currentIndex, 0, Count - (1 + downCount))); }
public bool CanItemIndexDecrement(int currentIndex, int count) { return(MathEx.IsWithin(currentIndex, count, Count - 1)); }