Table of Contents

Class SortDescription

Namespace
WinUI.TableView
Assembly
WinUI.TableView.dll

Describes a sort operation applied to TableView items.

public class SortDescription
Inheritance
object
SortDescription

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

propertyName string

The name of the property to sort by.

direction SortDirection

The direction of the sort.

comparer IComparer

An optional comparer to use for sorting.

valueDelegate Func<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

SortDirection

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

x object

The first object to compare.

y object

The 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

item object

The item to get the property value from.

Returns

object

The value of the property.