public override void Sort() { BindingListImpl.EndNew(); if (!BindingListImpl.IsSorted) { List.Sort(); if (List.Count > 1) { OnResetList(); } } else { if (BindingListImpl.SortProperty != null) { BindingListImpl.ApplySort(BindingListImpl.SortProperty, BindingListImpl.SortDirection); } else if (BindingListImpl.SortDescriptions != null) { BindingListImpl.ApplySort(BindingListImpl.SortDescriptions); } else { throw new InvalidOperationException("Currently applied sort method is not recognized/supported by EditableArrayList."); } } }
public override void Sort(IComparer comparer) { BindingListImpl.EndNew(); if (!BindingListImpl.IsSorted) { List.Sort(comparer); } else { throw new InvalidOperationException("Custom sorting is not supported on already sorted arrays. Invoke IBindingList.RemoveSort first."); } if (List.Count > 1) { OnResetList(); } }
public override void Reverse(int index, int count) { BindingListImpl.EndNew(); if (!BindingListImpl.IsSorted) { List.Reverse(index, count); } else { throw new InvalidOperationException("Range Reverse is not supported for already sorted arrays. Invoke IBindingList.RemoveSort() first."); } if (count > 1) { OnResetList(); } }
public override void Reverse() { BindingListImpl.EndNew(); if (!BindingListImpl.IsSorted) { List.Reverse(); } else { throw new InvalidOperationException("Reverse is not supported for already sorted arrays. Invoke IBindingList.RemoveSort() first or provide reverse sort direction."); } if (List.Count > 1) { OnResetList(); } }
public override void Sort(int index, int count, IComparer comparer) { BindingListImpl.EndNew(); if (!BindingListImpl.IsSorted) { _list.Sort(index, count, comparer); } else { throw new InvalidOperationException("Custom sorting is not supported on already sorted arrays. Invoke IBindingList.RemoveSort first."); } if (count > 1) { OnListChanged(ListChangedType.Reset, -1); } }
public void EndNew(int itemIndex) { BindingListImpl.EndNew(itemIndex); }