添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

Gets or sets a property name, or a period-delimited hierarchy of property names, that indicates the member to sort by.

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

Syntax

'Declaration
Public Property SortMemberPath As String
public string SortMemberPath { get; set; }
<sdk:dataGridColumn SortMemberPath="path"/>

XAML Values

  • sdk:dataGridColumn
    Typically, sdk:DataGridTextColumn, sdk:DataGridCheckBoxColumn, or sdk:DataGridTemplateColumn.

    A string that describes the target property. This can be a simple property name, or a property path to a sub-property.

    Remarks

    In columns that are derived from DataGridBoundColumn, such as DataGridTextColumn and DataGridCheckBoxColumn, the SortMemberPath is set to the property that the column is bound to through the Binding property by default. In columns that are derived from DataGridColumn, such as DataGridTemplateColumn, the SortMemberPath property must be set to enable automatic sorting of the column.

    Examples

    The following code example demonstrates how to set the SortMemberPath property. This example is part of a larger example available in the How to: Customize Auto-Generated Columns in the DataGrid Control topic.

    ' Create a new template column.
    Dim templateColumn As New DataGridTemplateColumn
    templateColumn.Header = "Due Date"
    templateColumn.CellTemplate = Me.Resources("dueDateCellTemplate")
    templateColumn.CellEditingTemplate = Me.Resources("dueDateCellEditingTemplate")
    templateColumn.SortMemberPath = "DueDate"
    
    // Create a new template column.
    DataGridTemplateColumn templateColumn = new DataGridTemplateColumn();
    templateColumn.Header = "Due Date";
    templateColumn.CellTemplate = (DataTemplate)Resources["dueDateCellTemplate"];
    templateColumn.CellEditingTemplate = (DataTemplate)Resources["dueDateCellEditingTemplate"];
    templateColumn.SortMemberPath = "DueDate";
    

    Platforms

    For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

    See Also

    Reference

    DataGridColumn Class

    System.Windows.Controls Namespace

    DataGrid

    CanUserSort

    Other Resources

    How to: Customize Auto-Generated Columns in the DataGrid Control

  •