DataGrid.AllowSorting 속성

정의

열 머리글을 클릭하여 표를 다시 정렬할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool AllowSorting { bool get(); void set(bool value); };
public bool AllowSorting { get; set; }
member this.AllowSorting : bool with get, set
Public Property AllowSorting As Boolean

속성 값

Boolean

열을 정렬할 수 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 속성을 토글합니다 AllowSorting .

private:
   void ToggleAllowSorting()
   {
      // Toggle the AllowSorting property.
      dataGrid1->AllowSorting =  !dataGrid1->AllowSorting;
   }
private void ToggleAllowSorting()
{
   // Toggle the AllowSorting property.
   dataGrid1.AllowSorting = ! dataGrid1.AllowSorting;
}
Private Sub ToggleAllowSorting()

   ' Toggle the AllowSorting property.
   DataGrid1.AllowSorting = Not DataGrid1.AllowSorting
End Sub

설명

컨트롤에 DataGridTableStyle.AllowSorting 현재 적용 중인 경우 이 속성은 DataGridTableStyle 속성에 의해 재정의됩니다.

정렬이 허용되는 경우 열 머리글을 클릭하면 해당 열별로 테이블 데이터가 정렬됩니다.

식을 사용하여 정렬할 수도 있습니다 DataColumn. 정렬 식을 만드는 방법에 대한 자세한 내용은 참조 Expression 하세요.

System.Windows.Forms.DataGrid 바인딩된 DataView경우 클래스의 Sort 속성을 사용하여 테이블에 대한 사용자 지정 정렬을 DataView 설정할 수 있습니다. 마찬가지로, 클래스에 System.Windows.Forms.DataGrid 바인딩DataViewManager된 경우 클래스의 속성을 설정하여 해당 테이블의 Sort 각 테이블에 DataViewManager 사용자 지정 정렬이 DataViewSettings 있을 수 있습니다.

적용 대상

추가 정보