Share via


SortDescriptor.Direction Property

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Gets or sets the sort direction.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.DomainServices (in System.Windows.Controls.DomainServices.dll)

Syntax

'Declaration
Public Property Direction As ListSortDirection
    Get
    Set
'Usage
Dim instance As SortDescriptor
Dim value As ListSortDirection

value = instance.Direction

instance.Direction = value
public ListSortDirection Direction { get; set; }
public:
property ListSortDirection Direction {
    ListSortDirection get ();
    void set (ListSortDirection value);
}
member Direction : ListSortDirection with get, set
function get Direction () : ListSortDirection
function set Direction (value : ListSortDirection)

Property Value

Type: System.ComponentModel.ListSortDirection
The sort direction.

Examples

The following example shows how to add a sort descriptor to the DomainDataSource. The data retrieved from the query is sorted by values in the StandardCost property.

<Grid x:Name="LayoutRoot" Background="White">  
    <riaControls:DomainDataSource x:Name="source" QueryName="GetProducts" AutoLoad="true">
        <riaControls:DomainDataSource.DomainContext>
            <domain:ProductDomainContext />
        </riaControls:DomainDataSource.DomainContext>   
        <riaControls:DomainDataSource.SortDescriptors>
            <riaData:SortDescriptor PropertyPath="StandardCost" Direction="Ascending" />
            <riaData:SortDescriptor PropertyPath="ProductID" Direction="Ascending" />
        </riaControls:DomainDataSource.SortDescriptors>
    </riaControls:DomainDataSource>
    <data:DataGrid ItemsSource="{Binding Data, ElementName=source}" />
</Grid>

See Also

Reference

SortDescriptor Class

System.Windows.Controls Namespace