DataGridSelectionUnit 枚举


定义指定单元格、 行或两者,是否用于 DataGrid 空间中的选择的常数。Defines constants that specify whether cells, rows, or both, are used for selection in a DataGrid control.

public enum class DataGridSelectionUnit
public enum DataGridSelectionUnit
type DataGridSelectionUnit = 
Public Enum DataGridSelectionUnit


Cell 0

只可选择单元格。Only cells are selectable. 单击某个单元格可将其选中。Clicking a cell selects the cell. 单击行或列标题不会执行任何操作。Clicking a row or column header does nothing.

CellOrRowHeader 2

可选择单元格和行。Cells and rows are selectable. 单击某个单元格时只可选择该单元格。Clicking a cell selects only the cell. 单击行标题可以选择整行。Clicking a row header selects the full row.

FullRow 1

只可选择整行。Only full rows are selectable. 单击单元格或行标题可以选择整行。Clicking a cell or a row header selects the full row.


和属性共同确定用户如何在中DataGrid选择项。 DataGrid.SelectionUnit DataGrid.SelectionModeThe DataGrid.SelectionMode and DataGrid.SelectionUnit properties together determine how users can select items in a DataGrid. 例如DataGrid.SelectionMode , 如果DataGridDataGridSelectionMode.Single , 并且DataGrid.SelectionUnitCell, 则用户在中一次只能选择一个单元格。For example, if the DataGrid.SelectionMode is DataGridSelectionMode.Single and the DataGrid.SelectionUnit is Cell, the user can select only one cell at a time in the DataGrid.