Share via


DomainDataSource.SortDescriptors 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 the collection of sort descriptor objects that are used to sort the data.

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

Syntax

'Declaration
Public Property SortDescriptors As SortDescriptorCollection
    Get
    Private Set
'Usage
Dim instance As DomainDataSource
Dim value As SortDescriptorCollection

value = instance.SortDescriptors
public SortDescriptorCollection SortDescriptors { get; private set; }
public:
property SortDescriptorCollection^ SortDescriptors {
    SortDescriptorCollection^ get ();
    private: void set (SortDescriptorCollection^ value);
}
member SortDescriptors : SortDescriptorCollection with get, private set
function get SortDescriptors () : SortDescriptorCollection
private function set SortDescriptors (value : SortDescriptorCollection)

Property Value

Type: System.Windows.Controls.SortDescriptorCollection
The collection of sort descriptor objects that are used to sort the data.

Remarks

During a Load operation, the SortDescriptors property will be used to perform server-side sorting. The specified sorting will also be used as changes are made to the loaded entities, with the Data and DataView properties reflecting the changes.

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 StandardPrice 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

DomainDataSource Class

System.Windows.Controls Namespace

Other Resources

DomainDataSource