DataGridViewColumnSortMode DataGridViewColumnSortMode DataGridViewColumnSortMode DataGridViewColumnSortMode Enum

定义

定义用户可以用何种方式对 DataGridView 列进行排序。Defines how a DataGridView column can be sorted by the user.

public enum class DataGridViewColumnSortMode
public enum DataGridViewColumnSortMode
type DataGridViewColumnSortMode = 
Public Enum DataGridViewColumnSortMode
继承
DataGridViewColumnSortModeDataGridViewColumnSortModeDataGridViewColumnSortModeDataGridViewColumnSortMode

字段

Automatic Automatic Automatic Automatic 1

除非列标头用于进行选择,否则用户可以通过单击列标头(或在单元格上按 F3)对列进行排序。The user can sort the column by clicking the column header (or pressing F3 on a cell) unless the column headers are used for selection. 排序标志符号将自动显示出来。A sorting glyph will be displayed automatically.

NotSortable NotSortable NotSortable NotSortable 0

此列仅能以编程方式进行排序,但由于它原本并不打算排序,所以列标头将不包含排序标志符号的空间。The column can only be sorted programmatically, but it is not intended for sorting, so the column header will not include space for a sorting glyph.

Programmatic Programmatic Programmatic Programmatic 2

此列仅能以编程方式进行排序,并且列标头将包含排序标志符号的空间。The column can only be sorted programmatically, and the column header will include space for a sorting glyph.

示例

下面的代码示例演示如何使用此类型。The following code example illustrates the use of this type. 有关详细信息,请参阅如何:在 Windows 窗体 DataGridView 控件中设置列的排序模式。For more information, see How to: Set the Sort Modes for Columns in the Windows Forms DataGridView Control.

this.dataGridView1.Columns["Priority"].SortMode =
    DataGridViewColumnSortMode.Automatic;
Me.dataGridView1.Columns("Priority").SortMode = _
    DataGridViewColumnSortMode.Automatic

注解

每个列可能具有不同的排序模式, 由SortMode属性指定。Each column may have a different sort mode specified by the SortMode property.

适用于

另请参阅