SH
Stefan Hoenig
Syncfusion Team
November 4, 2002 05:41 PM UTC
Hi Anthony,
the following methods should let you do all the sorting directly on the underlying datasource:
public static ListSortDirection GetSortDirection(IList list)
{
if (list is IBindingList && ((IBindingList)list).SupportsSorting)
return ((IBindingList)list).SortDirection;
return ListSortDirection.Ascending;
}
public static PropertyDescriptor GetSortProperty(IList list)
{
if (list is IBindingList && ((IBindingList)list).SupportsSorting)
return ((IBindingList)list).SortProperty;
return null;
}
public static void SetSort(IList list, PropertyDescriptor property, ListSortDirection sortDirection)
{
if (list is IBindingList && ((IBindingList)list).SupportsSorting)
((IBindingList)list).ApplySort(property, sortDirection);
}
public static bool SupportsSort(IList list)
{
return list is IBindingList && ((IBindingList)list).SupportsSorting;
}
I'll make a note that the Sort method in the GridModelDataBinder should accept a SortDirection.
Stefan