void IBindingList.RemoveSort() { EntityList <T> list = InnerList as EntityList <T>; if (list == null || list.Count < 1) { return; } FieldItem fi = Factory.Fields[0]; Boolean isDesc = false; foreach (FieldItem item in Factory.Fields) { if (item.IsIdentity) { fi = item; isDesc = true; break; } else if (item.PrimaryKey) { fi = item; isDesc = false; break; } } list.Sort(Factory.Fields[0].Name, isDesc); IsSorted = false; SortProperty = null; SortDirection = ListSortDirection.Ascending; OnListChanged(ResetEventArgs); }
void IBindingListView.ApplySort(ListSortDescriptionCollection sorts) { if (sorts == null || sorts.Count < 1) { return; } EntityList <T> list = InnerList as EntityList <T>; if (list == null || list.Count < 1) { return; } List <String> ns = new List <string>(); List <Boolean> ds = new List <bool>(); foreach (ListSortDescription item in sorts) { ns.Add(item.PropertyDescriptor.Name); ds.Add(item.SortDirection == ListSortDirection.Descending); } list.Sort(ns.ToArray(), ds.ToArray()); SortDescriptions = sorts; OnListChanged(ResetEventArgs); }
void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection direction) { EntityList <T> list = InnerList as EntityList <T>; if (list == null || list.Count < 1) { return; } list.Sort(property.Name, direction == ListSortDirection.Descending); IsSorted = true; SortProperty = property; SortDirection = direction; OnListChanged(ResetEventArgs); }