c# Programming Glossary: listsortdirection
BindingList<T>.Sort() to behave like a List<T>.Sort() http://stackoverflow.com/questions/1063917/bindinglistt-sort-to-behave-like-a-listt-sort than making a call to ApplySortCore PropertyDescriptor ListSortDirection . The reason is because I have quite a great deal of code that's.. T p_Comparison m_SortProperty null m_SortDirection ListSortDirection.Ascending Extract items and sort separately List T sortList..
How to sort databound DataGridView column? http://stackoverflow.com/questions/1699642/how-to-sort-databound-datagridview-column override bool IsSortedCore get return isSortedValue ListSortDirection sortDirectionValue PropertyDescriptor sortPropertyValue protected.. override void ApplySortCore PropertyDescriptor prop ListSortDirection direction sortedList new ArrayList Type interfaceType prop.PropertyType.GetInterface.. direction IEnumerable T query base.Items if direction ListSortDirection.Ascending query query.OrderBy i prop.GetValue i else query..
DataGridView Column sorting with Business Objects http://stackoverflow.com/questions/280948/datagridview-column-sorting-with-business-objects return true You will also need to implement the sort code ListSortDirection sortDirectionValue PropertyDescriptor sortPropertyValue protected.. override void ApplySortCore PropertyDescriptor prop ListSortDirection direction sortedList new ArrayList Check to see if the property.. copy the sorted items back into the list. if direction ListSortDirection.Descending sortedList.Reverse for int i 0 i this.Count i int..
Use own IComparer<T> with Linq OrderBy http://stackoverflow.com/questions/985657/use-own-icomparert-with-linq-orderby override void ApplySortCore PropertyDescriptor property ListSortDirection direction _sortProperty property _sortDirection direction var.. direction var items this.Items switch direction case ListSortDirection.Ascending items items.OrderByDescending x property.GetValue.. x property.GetValue x .ToList break case ListSortDirection.Descending items items.OrderByDescending x property.GetValue..
|