Share via


4.142 DataGrid (4)

x:Object > DependencyObject > Visual > UIElement > FrameworkElement > Control > ItemsControl > Selector > MultiSelector > DataGrid, IInputElement

(usage)

<DataGrid> x:Object *</DataGrid>

(description)

Represents a control that displays data in a customizable grid.

[content property]

Items

[name property]

Name

[xml lang property]

Language

(properties)

AlternatingRowBackground

Brush

(description)

The background brush for use on alternating rows.

AreRowDetailsFrozen

x:Boolean

(description)

A value that indicates whether the row details can scroll horizontally.

AutoGenerateColumns

x:Boolean

(description)

A value that indicates whether the columns are created automatically.

CanUserAddRows

x:Boolean

(description)

A value that indicates whether the user can add new rows to the DataGrid.

CanUserDeleteRows

x:Boolean

(description)

A value that indicates whether the user can delete rows from the DataGrid.

CanUserReorderColumns

x:Boolean

(description)

A value that indicates whether the user can change the column display order by dragging column headers with the mouse.

CanUserResizeColumns

x:Boolean

(description)

A value that indicates whether the user can adjust the width of columns by using the mouse.

CanUserResizeRows

x:Boolean

(description)

A value that indicates whether the user can adjust the height of rows by using the mouse.

CanUserSortColumns

x:Boolean

(description)

A value that indicates whether the user can sort columns by clicking the column header.

CellStyle

Style

(description)

The style applied to all cells in the DataGrid.

ClipboardCopyMode

DataGridClipboardCopyMode

(description)

A value that indicates how content is copied to the clipboard.

ColumnHeaderHeight

x:Double

(description)

The height of the column headers row.

ColumnHeaderStyle

Style

(description)

The style applied to all column headers in the DataGrid.

Columns

ObservableCollection(DataGridColumn)

(description)

A collection that contains all the columns in the DataGrid.

[read only]

true

ColumnWidth

DataGridLength

(description)

The standard width and sizing mode of columns and headers in the DataGrid.

CurrentCell

DataGridCellInfo

(description)

The cell that has focus.

CurrentColumn

DataGridColumn

(description)

The column that contains the current cell.

CurrentItem

x:Object

(description)

The data item bound to the row that contains the current cell.

DragIndicatorStyle

Style

(description)

The style that is used when rendering the drag indicator that is displayed while dragging a column header.

DropLocationIndicatorStyle

Style

(description)

The style that is applied to indicate the drop location when dragging a column header.

EnableColumnVirtualization

x:Boolean

(description)

A value that indicates whether column virtualization is enabled.

EnableRowVirtualization

x:Boolean

(description)

A value that indicates whether row virtualization is enabled.

FrozenColumnCount

x:Int32

(description)

The number of non-scrolling columns.

GridLinesVisibility

DataGridGridLinesVisibility

(description)

A value that indicates which grid lines are shown.

HeadersVisibility

DataGridHeadersVisibility

(description)

The value that specifies the visibility of the row and column headers.

HorizontalGridLinesBrush

Brush

(description)

The brush that is used to draw the horizontal grid lines.

HorizontalScrollBarVisibility

ScrollBarVisibility

(description)

A value that indicates how horizontal scroll bars are displayed in the DataGrid.

IsReadOnly

x:Boolean

(description)

A value that indicates whether the user can edit values in the DataGrid.

MaxColumnWidth

x:Double

(description)

The maximum width constraint of the columns and headers in the DataGrid.

MinColumnWidth

x:Double

(description)

The minimum width constraint of the columns and headers in the DataGrid.

MinRowHeight

x:Double

(description)

The minimum height constraint of the rows and headers in the DataGrid.

RowBackground

Brush

(description)

The default brush for the row background.

RowDetailsTemplate

DataTemplate

(description)

The template that is used to display the row details.

RowDetailsTemplateSelector

DataTemplateSelector

(description)

The template selector that is used for the row details.

RowDetailsVisibilityMode

DataGridRowDetailsVisibilityMode

(description)

A value that indicates when the details section of a row is displayed.

RowHeaderStyle

Style

(description)

The style applied to all row headers.

RowHeaderTemplate

DataTemplate

(description)

The template for the row headers.

RowHeaderTemplateSelector

DataTemplateSelector

(description)

The template selector for row headers.

RowHeaderWidth

x:Double

(description)

The width of the row header column.

RowHeight

x:Double

(description)

The suggested height for all rows.

RowStyle

Style

(description)

The style applied to all rows.

RowStyleSelector

StyleSelector

(description)

The style selector for the rows.

RowValidationErrorTemplate

ControlTemplate

(description)

The template that is used to visually indicate an error in row validation.

RowValidationRules

ObservableCollection(ValidationRule)

(description)

The rules that are used to validate the data in each row.

[read only]

true

SelectedCells

IList(DataGridCellInfo)

(description)

The list of cells that are currently selected.

[read only]

true

SelectionMode

DataGridSelectionMode

(description)

A value that indicates how rows and cells are selected in the DataGrid.

SelectionUnit

DataGridSelectionUnit

(description)

A value that indicates whether rows, cells, or both can be selected in the DataGrid.

VerticalGridLinesBrush

Brush

(description)

The brush that is used to draw the vertical grid lines.

VerticalScrollBarVisibility

ScrollBarVisibility

(description)

A value that indicates how vertical scroll bars are displayed in the DataGrid.

(static properties)

DeleteCommand

RoutedUICommand

(description)

Represents the command that indicates the intention to delete the current row.

FocusBorderBrushKey

ComponentResourceKey

(description)

The key that references the default border brush for a focused cell.

HeadersVisibilityConverter

IValueConverter

(description)

The converter that converts a DataGridHeadersVisibility to a Visibility.

RowDetailsScrollingConverter

IValueConverter

(description)

The converter that converts a Boolean value to a SelectiveScrollingOrientation.

SelectAllCommand

RoutedUICommand

(description)

Represents the command that indicates the intention to select all cells in the DataGrid.

(events)

AutoGeneratedColumns

Occurs when auto generation of all columns is completed.

AutoGeneratingColumn

Occurs when an individual column is auto-generated.

BeginningEdit

Occurs before a row or cell enters edit mode.

CellEditEnding

Occurs before a cell edit is committed or canceled.

ColumnDisplayIndexChanged

Occurs when the DisplayIndex property on one of the columns changes.

ColumnHeaderDragCompleted

Occurs when the user releases a column header after dragging it by using the mouse.

ColumnHeaderDragDelta

Occurs every time the mouse position changes while the user drags a column header.

ColumnHeaderDragStarted

Occurs when the user begins dragging a column header by using the mouse.

ColumnReordered

Occurs when a column moves to a new position in the display order.

ColumnReordering

Occurs before a column moves to a new position in the display order.

CopyingRowClipboardContent

Occurs after the default row content is prepared.

CurrentCellChanged

Occurs when the value of the CurrentCell property has changed.

InitializingNewItem

Occurs when a new item is created.

LoadingRow

Occurs after a DataGridRow is instantiated, so that you can customize it before it is used.

LoadingRowDetails

Occurs when a new row details template is applied to a row.

PreparingCellForEdit

Occurs when a cell enters edit mode.

RowDetailsVisibilityChanged

Occurs when the visibility of a row details element changes.

RowEditEnding

Occurs before a row edit is committed or canceled.

SelectedCellsChanged

Occurs when the SelectedCells collection changes.

Sorting

Occurs when a column is being sorted.

UnloadingRow

Occurs when a DataGridRow object becomes available for reuse.

UnloadingRowDetails

Occurs when a row details element becomes available for reuse.