Class SortDescription
Describes a sort operation applied to TableView items.
public class SortDescription
- Inheritance
-
objectSortDescription
Constructors
SortDescription(string?, SortDirection, IComparer?, Func<object?, object?>?)
Initializes a new instance of the SortDescription class that describes a sort on the object itself
public SortDescription(string? propertyName, SortDirection direction, IComparer? comparer = null, Func<object?, object?>? valueDelegate = null)
Parameters
propertyNamestringThe name of the property to sort by.
directionSortDirectionThe direction of the sort.
comparerIComparerAn optional comparer to use for sorting.
valueDelegateFunc<object, object>An optional delegate to extract the value to sort by.
Properties
Comparer
Gets the comparer to use for sorting.
public IComparer? Comparer { get; }
Property Value
- IComparer
Direction
Gets the direction of the sort.
public SortDirection Direction { get; }
Property Value
PropertyName
Gets the name of the property to sort by.
public string? PropertyName { get; }
Property Value
- string
ValueDelegate
Gets the delegate to extract the value to sort by.
public Func<object?, object?>? ValueDelegate { get; }
Property Value
- Func<object, object>
Methods
Compare(object?, object?)
Compares two objects based on the sort description.
public int Compare(object? x, object? y)
Parameters
xobjectThe first object to compare.
yobjectThe second object to compare.
Returns
- int
An integer that indicates the relative order of the objects being compared.
GetPropertyValue(object?)
Gets the value of the specified property from the given item.
public virtual object? GetPropertyValue(object? item)
Parameters
itemobjectThe item to get the property value from.
Returns
- object
The value of the property.