Class DataGrid
Displays data in a customizable grid.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.Data.dll
Syntax
[TemplatePart(Name = "RowsPresenter", Type = typeof(DataGridRowsPresenter))]
[TemplatePart(Name = "ColumnHeadersPresenter", Type = typeof(DataGridColumnHeadersPresenter))]
[TemplatePart(Name = "FrozenColumnScrollBarSpacer", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "HorizontalScrollbar", Type = typeof(ScrollBar))]
[TemplatePart(Name = "ValidationSummary", Type = typeof(ValidationSummary))]
[TemplatePart(Name = "VerticalScrollbar", Type = typeof(ScrollBar))]
[StyleTypedProperty(Property = "CellStyle", StyleTargetType = typeof(DataGridCell))]
[StyleTypedProperty(Property = "ColumnHeaderStyle", StyleTargetType = typeof(DataGridColumnHeader))]
[StyleTypedProperty(Property = "DragIndicatorStyle", StyleTargetType = typeof(ContentControl))]
[StyleTypedProperty(Property = "DropLocationIndicatorStyle", StyleTargetType = typeof(ContentControl))]
[StyleTypedProperty(Property = "RowHeaderStyle", StyleTargetType = typeof(DataGridRowHeader))]
[StyleTypedProperty(Property = "RowStyle", StyleTargetType = typeof(DataGridRow))]
public class DataGrid : Control
Constructors
| Improve this Doc View SourceDataGrid()
Initializes a new instance of the DataGrid class.
Declaration
public DataGrid()
Fields
| Improve this Doc View SourceAlternatingRowBackgroundProperty
Identifies the AlternatingRowBackground dependency property.
Declaration
public static readonly DependencyProperty AlternatingRowBackgroundProperty
Field Value
Type | Description |
---|---|
DependencyProperty | The identifier for the AlternatingRowBackground dependency property. |
AreRowDetailsFrozenProperty
Identifies the AreRowDetailsFrozen dependency property.
Declaration
public static readonly DependencyProperty AreRowDetailsFrozenProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
AreRowGroupHeadersFrozenProperty
Identifies the AreRowDetailsFrozen dependency property.
Declaration
public static readonly DependencyProperty AreRowGroupHeadersFrozenProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
AutoGenerateColumnsProperty
Identifies the AutoGenerateColumns dependency property.
Declaration
public static readonly DependencyProperty AutoGenerateColumnsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CanUserReorderColumnsProperty
Identifies the CanUserReorderColumns dependency property.
Declaration
public static readonly DependencyProperty CanUserReorderColumnsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CanUserResizeColumnsProperty
Identifies the CanUserResizeColumns dependency property.
Declaration
public static readonly DependencyProperty CanUserResizeColumnsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CanUserSortColumnsProperty
Identifies the CanUserSortColumns dependency property.
Declaration
public static readonly DependencyProperty CanUserSortColumnsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CellStyleProperty
Identifies the CellStyle dependency property.
Declaration
public static readonly DependencyProperty CellStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ClipboardCopyModeProperty
Identifies the ClipboardCopyMode dependency property.
Declaration
public static readonly DependencyProperty ClipboardCopyModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ColumnHeaderHeightProperty
Identifies the ColumnHeaderHeight dependency property.
Declaration
public static readonly DependencyProperty ColumnHeaderHeightProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ColumnHeaderStyleProperty
Identifies the ColumnHeaderStyle dependency property.
Declaration
public static readonly DependencyProperty ColumnHeaderStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ColumnWidthProperty
Identifies the ColumnWidth dependency property.
Declaration
public static readonly DependencyProperty ColumnWidthProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
DragIndicatorStyleProperty
Identifies the DragIndicatorStyle dependency property.
Declaration
public static readonly DependencyProperty DragIndicatorStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
DropLocationIndicatorStyleProperty
Identifies the DropLocationIndicatorStyle dependency property.
Declaration
public static readonly DependencyProperty DropLocationIndicatorStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FrozenColumnCountProperty
Identifies the FrozenColumnCount dependency property.
Declaration
public static readonly DependencyProperty FrozenColumnCountProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
GridLinesVisibilityProperty
Identifies the GridLines dependency property.
Declaration
public static readonly DependencyProperty GridLinesVisibilityProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
HeadersVisibilityProperty
Identifies the HeadersVisibility dependency property.
Declaration
public static readonly DependencyProperty HeadersVisibilityProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
HorizontalGridLinesBrushProperty
Identifies the HorizontalGridLinesBrush dependency property.
Declaration
public static readonly DependencyProperty HorizontalGridLinesBrushProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
HorizontalScrollBarVisibilityProperty
Identifies the HorizontalScrollBarVisibility dependency property.
Declaration
public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsReadOnlyProperty
Identifies the IsReadOnly dependency property.
Declaration
public static readonly DependencyProperty IsReadOnlyProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsValidProperty
Identifies the IsValid dependency property.
Declaration
public static readonly DependencyProperty IsValidProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ItemsSourceProperty
Identifies the ItemsSource dependency property.
Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MaxColumnWidthProperty
Identifies the MaxColumnWidth dependency property.
Declaration
public static readonly DependencyProperty MaxColumnWidthProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
MinColumnWidthProperty
Identifies the MinColumnWidth dependency property.
Declaration
public static readonly DependencyProperty MinColumnWidthProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowBackgroundProperty
Identifies the RowBackground dependency property.
Declaration
public static readonly DependencyProperty RowBackgroundProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowDetailsTemplateProperty
Identifies the RowDetailsTemplate dependency property.
Declaration
public static readonly DependencyProperty RowDetailsTemplateProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowDetailsVisibilityModeProperty
Identifies the RowDetailsVisibilityMode dependency property.
Declaration
public static readonly DependencyProperty RowDetailsVisibilityModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowHeaderStyleProperty
Identifies the RowHeaderStyle dependency property.
Declaration
public static readonly DependencyProperty RowHeaderStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowHeaderWidthProperty
Identifies the RowHeaderWidth dependency property.
Declaration
public static readonly DependencyProperty RowHeaderWidthProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowHeightProperty
Identifies the RowHeight dependency property.
Declaration
public static readonly DependencyProperty RowHeightProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
RowStyleProperty
Identifies the RowStyle dependency property.
Declaration
public static readonly DependencyProperty RowStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectionModeProperty
Identifies the SelectionMode dependency property.
Declaration
public static readonly DependencyProperty SelectionModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
VerticalGridLinesBrushProperty
Identifies the VerticalGridLinesBrush dependency property.
Declaration
public static readonly DependencyProperty VerticalGridLinesBrushProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
VerticalScrollBarVisibilityProperty
Identifies the VerticalScrollBarVisibility dependency property.
Declaration
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceAlternatingRowBackground
Gets or sets the Brush that is used to paint the background of odd-numbered rows.
Declaration
public Brush AlternatingRowBackground { get; set; }
Property Value
Type | Description |
---|---|
Brush | The brush that is used to paint the background of odd-numbered rows. The default is a SolidColorBrush with a Color value of white (ARGB value #00FFFFFF). |
AreRowDetailsFrozen
Gets or sets a value that indicates whether the row details sections remain fixed at the width of the display area or can scroll horizontally.
Declaration
public bool AreRowDetailsFrozen { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AreRowGroupHeadersFrozen
Gets or sets a value that indicates whether the row group header sections remain fixed at the width of the display area or can scroll horizontally.
Declaration
public bool AreRowGroupHeadersFrozen { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AutoGenerateColumns
Gets or sets a value that indicates whether columns are created automatically when the ItemsSource property is set.
Declaration
public bool AutoGenerateColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanUserReorderColumns
Gets or sets a value that indicates whether the user can change the column display order by dragging column headers with the mouse.
Declaration
public bool CanUserReorderColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanUserResizeColumns
Gets or sets a value that indicates whether the user can adjust column widths using the mouse.
Declaration
public bool CanUserResizeColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanUserSortColumns
Gets or sets a value that indicates whether the user can sort columns by clicking the column header.
Declaration
public bool CanUserSortColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CellStyle
Gets or sets the style that is used when rendering the data grid cells.
Declaration
public Style CellStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
ClipboardCopyMode
The property which determines how DataGrid content is copied to the Clipboard.
Declaration
public DataGridClipboardCopyMode ClipboardCopyMode { get; set; }
Property Value
Type | Description |
---|---|
DataGridClipboardCopyMode |
ColumnHeaderHeight
Gets or sets the height of the column headers row.
Declaration
public double ColumnHeaderHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ColumnHeaderStyle
Gets or sets the style that is used when rendering the column headers.
Declaration
public Style ColumnHeaderStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
Columns
Gets a collection that contains all the columns in the control.
Declaration
public ObservableCollection<DataGridColumn> Columns { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<DataGridColumn> |
ColumnWidth
Gets or sets the standard width or automatic sizing mode of columns in the control.
Declaration
public DataGridLength ColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
DataGridLength |
CurrentColumn
Gets or sets the column that contains the current cell.
Declaration
public DataGridColumn CurrentColumn { get; set; }
Property Value
Type | Description |
---|---|
DataGridColumn |
CurrentItem
Gets the data item bound to the row that contains the current cell.
Declaration
protected object CurrentItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
DragIndicatorStyle
Gets or sets the style that is used when rendering the drag indicator that is displayed while dragging column headers.
Declaration
public Style DragIndicatorStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
DropLocationIndicatorStyle
Gets or sets the style that is used when rendering the column headers.
Declaration
public Style DropLocationIndicatorStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
FrozenColumnCount
Gets or sets the number of columns that the user cannot scroll horizontally.
Declaration
public int FrozenColumnCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
GridLinesVisibility
Gets or sets a value that indicates which grid lines separating inner cells are shown.
Declaration
public DataGridGridLinesVisibility GridLinesVisibility { get; set; }
Property Value
Type | Description |
---|---|
DataGridGridLinesVisibility |
HeadersVisibility
Gets or sets a value that indicates the visibility of row and column headers.
Declaration
public DataGridHeadersVisibility HeadersVisibility { get; set; }
Property Value
Type | Description |
---|---|
DataGridHeadersVisibility |
HorizontalGridLinesBrush
Gets or sets the Brush that is used to paint grid lines separating rows.
Declaration
public Brush HorizontalGridLinesBrush { get; set; }
Property Value
Type | Description |
---|---|
Brush |
HorizontalScrollBarVisibility
Gets or sets a value that indicates how the horizontal scroll bar is displayed.
Declaration
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisibility |
IsReadOnly
Gets or sets a value that indicates whether the user can edit the values in the control.
Declaration
public bool IsReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsValid
Gets a value that indicates whether data in the grid is valid.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ItemsSource
Gets or sets a collection that is used to generate the content of the control.
Declaration
public IEnumerable ItemsSource { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.IEnumerable |
MaxColumnWidth
Gets or sets the maximum width of columns in the DataGrid .
Declaration
public double MaxColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MinColumnWidth
Gets or sets the minimum width of columns in the DataGrid.
Declaration
public double MinColumnWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
RowBackground
Gets or sets the Brush that is used to paint row backgrounds.
Declaration
public Brush RowBackground { get; set; }
Property Value
Type | Description |
---|---|
Brush |
RowDetailsTemplate
Gets or sets the template that is used to display the content of the details section of rows.
Declaration
public DataTemplate RowDetailsTemplate { get; set; }
Property Value
Type | Description |
---|---|
DataTemplate |
RowDetailsVisibilityMode
Gets or sets a value that indicates when the details sections of rows are displayed.
Declaration
public DataGridRowDetailsVisibilityMode RowDetailsVisibilityMode { get; set; }
Property Value
Type | Description |
---|---|
DataGridRowDetailsVisibilityMode |
RowGroupHeaderStyles
Gets or sets the style that is used when rendering the row group header.
Declaration
public ObservableCollection<Style> RowGroupHeaderStyles { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ObservableCollection<Style> |
RowHeaderStyle
Gets or sets the style that is used when rendering the row headers.
Declaration
public Style RowHeaderStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
RowHeaderWidth
Gets or sets the width of the row header column.
Declaration
public double RowHeaderWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
RowHeight
Gets or sets the standard height of rows in the control.
Declaration
public double RowHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
RowStyle
Gets or sets the style that is used when rendering the rows.
Declaration
public Style RowStyle { get; set; }
Property Value
Type | Description |
---|---|
Style |
SelectedIndex
Gets or sets the index of the current selection.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the current selection, or -1 if the selection is empty. |
SelectedItem
Gets or sets the data item corresponding to the selected row.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
SelectedItems
Gets a list that contains the data items corresponding to the selected rows.
Declaration
public IList SelectedItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.IList |
SelectionMode
Gets or sets the selection behavior of the data grid.
Declaration
public DataGridSelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
DataGridSelectionMode |
VerticalGridLinesBrush
Gets or sets the Brush that is used to paint grid lines separating columns.
Declaration
public Brush VerticalGridLinesBrush { get; set; }
Property Value
Type | Description |
---|---|
Brush |
VerticalScrollBarVisibility
Gets or sets a value that indicates how the vertical scroll bar is displayed.
Declaration
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Property Value
Type | Description |
---|---|
ScrollBarVisibility |
Methods
| Improve this Doc View SourceArrangeOverride(Size)
Arranges the content of the DataGridRow.
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
Size | finalSize | The final area within the parent that this element should use to arrange itself and its children. |
Returns
Type | Description |
---|---|
Size | The actual size used by the DataGridRow. |
Overrides
| Improve this Doc View SourceBeginEdit()
Enters editing mode for the current cell and current row (if they're not already in editing mode).
Declaration
public bool BeginEdit()
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
BeginEdit(RoutedEventArgs)
Enters editing mode for the current cell and current row (if they're not already in editing mode).
Declaration
public bool BeginEdit(RoutedEventArgs editingEventArgs)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | editingEventArgs | Provides information about the user gesture that caused the call to BeginEdit. Can be null. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
CancelEdit()
Cancels editing mode and restores the original value.
Declaration
public bool CancelEdit()
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
CancelEdit(DataGridEditingUnit)
Cancels editing mode for the specified DataGridEditingUnit and restores its original value.
Declaration
public bool CancelEdit(DataGridEditingUnit editingUnit)
Parameters
Type | Name | Description |
---|---|---|
DataGridEditingUnit | editingUnit | Specifies whether to cancel edit for a Cell or Row. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
CollapseRowGroup(CollectionViewGroup, Boolean)
Collapses the DataGridRowGroupHeader that represents a given CollectionViewGroup
Declaration
public void CollapseRowGroup(CollectionViewGroup collectionViewGroup, bool collapseAllSubgroups)
Parameters
Type | Name | Description |
---|---|---|
CollectionViewGroup | collectionViewGroup | CollectionViewGroup |
System.Boolean | collapseAllSubgroups | Set to true to collapse all Subgroups |
CommitEdit()
Commits editing mode and pushes changes to the backend.
Declaration
public bool CommitEdit()
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
CommitEdit(DataGridEditingUnit, Boolean)
Commits editing mode for the specified DataGridEditingUnit and pushes changes to the backend.
Declaration
public bool CommitEdit(DataGridEditingUnit editingUnit, bool exitEditingMode)
Parameters
Type | Name | Description |
---|---|---|
DataGridEditingUnit | editingUnit | Specifies whether to commit edit for a Cell or Row. |
System.Boolean | exitEditingMode | Editing mode is left if True. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation was successful. False otherwise. |
ExpandRowGroup(CollectionViewGroup, Boolean)
Expands the DataGridRowGroupHeader that represents a given CollectionViewGroup
Declaration
public void ExpandRowGroup(CollectionViewGroup collectionViewGroup, bool expandAllSubgroups)
Parameters
Type | Name | Description |
---|---|---|
CollectionViewGroup | collectionViewGroup | CollectionViewGroup |
System.Boolean | expandAllSubgroups | Set to true to expand all Subgroups |
GetGroupFromItem(Object, Int32)
Returns the Group at the indicated level or null if the item is not in the ItemsSource
Declaration
public CollectionViewGroup GetGroupFromItem(object item, int groupLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | item |
System.Int32 | groupLevel | groupLevel |
Returns
Type | Description |
---|---|
CollectionViewGroup | The group the given item falls under or null if the item is not in the ItemsSource |
MeasureOverride(Size)
Measures the children of a DataGridRow to prepare for arranging them during the ArrangeOverride(Size) pass.
Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
Size | availableSize | The available size that this element can give to child elements. Indicates an upper limit that child elements should not exceed. |
Returns
Type | Description |
---|---|
Size | The size that the DataGridRow determines it needs during layout, based on its calculations of child object allocated sizes. |
Overrides
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the column header when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnAutoGeneratingColumn(DataGridAutoGeneratingColumnEventArgs)
Raises the AutoGeneratingColumn event.
Declaration
protected virtual void OnAutoGeneratingColumn(DataGridAutoGeneratingColumnEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridAutoGeneratingColumnEventArgs | e |
OnBeginningEdit(DataGridBeginningEditEventArgs)
Raises the BeginningEdit event.
Declaration
protected virtual void OnBeginningEdit(DataGridBeginningEditEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridBeginningEditEventArgs | e |
OnCellEditEnded(DataGridCellEditEndedEventArgs)
Raises the CellEditEnded event.
Declaration
protected virtual void OnCellEditEnded(DataGridCellEditEndedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridCellEditEndedEventArgs | e |
OnCellEditEnding(DataGridCellEditEndingEventArgs)
Raises the CellEditEnding event.
Declaration
protected virtual void OnCellEditEnding(DataGridCellEditEndingEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridCellEditEndingEventArgs | e |
OnColumnDisplayIndexChanged(DataGridColumnEventArgs)
Declaration
protected virtual void OnColumnDisplayIndexChanged(DataGridColumnEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridColumnEventArgs | e |
OnColumnReordered(DataGridColumnEventArgs)
Declaration
protected virtual void OnColumnReordered(DataGridColumnEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridColumnEventArgs | e |
OnColumnReordering(DataGridColumnReorderingEventArgs)
Declaration
protected virtual void OnColumnReordering(DataGridColumnReorderingEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridColumnReorderingEventArgs | e |
OnCopyingRowClipboardContent(DataGridRowClipboardEventArgs)
This method raises the CopyingRowClipboardContent event.
Declaration
protected virtual void OnCopyingRowClipboardContent(DataGridRowClipboardEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowClipboardEventArgs | e | Contains the necessary information for generating the row clipboard content. |
OnCreateAutomationPeer()
Creates AutomationPeer (OnCreateAutomationPeer())
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer |
Overrides
| Improve this Doc View SourceOnCurrentCellChanged(EventArgs)
Raises the CurrentCellChanged event.
Declaration
protected virtual void OnCurrentCellChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e |
OnLoadingRow(DataGridRowEventArgs)
Raises the LoadingRow event for row preparation.
Declaration
protected virtual void OnLoadingRow(DataGridRowEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowEventArgs | e |
OnLoadingRowDetails(DataGridRowDetailsEventArgs)
Raises the LoadingRowDetails for row details preparation
Declaration
protected virtual void OnLoadingRowDetails(DataGridRowDetailsEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowDetailsEventArgs | e |
OnLoadingRowGroup(DataGridRowGroupHeaderEventArgs)
Raises the LoadingRowGroup event
Declaration
protected virtual void OnLoadingRowGroup(DataGridRowGroupHeaderEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowGroupHeaderEventArgs | e | EventArgs |
OnMouseWheel(MouseWheelEventArgs)
Scrolls the DataGrid according to the direction of the delta.
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseWheelEventArgs | e | MouseWheelEventArgs |
Overrides
| Improve this Doc View SourceOnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs)
Raises the PreparingCellForEdit event.
Declaration
protected virtual void OnPreparingCellForEdit(DataGridPreparingCellForEditEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridPreparingCellForEditEventArgs | e |
OnRowDetailsVisibilityChanged(DataGridRowDetailsEventArgs)
Raises the RowDetailsVisibilityChanged event.
Declaration
protected virtual void OnRowDetailsVisibilityChanged(DataGridRowDetailsEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowDetailsEventArgs | e | The event data. |
OnRowEditEnded(DataGridRowEditEndedEventArgs)
Raises the RowEditEnded event.
Declaration
protected virtual void OnRowEditEnded(DataGridRowEditEndedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowEditEndedEventArgs | e |
OnRowEditEnding(DataGridRowEditEndingEventArgs)
Raises the RowEditEnding event.
Declaration
protected virtual void OnRowEditEnding(DataGridRowEditEndingEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowEditEndingEventArgs | e |
OnSelectionChanged(SelectionChangedEventArgs)
Raises the SelectionChanged event and clears the _selectionChanged. This event won't get raised again until after _selectionChanged is set back to true.
Declaration
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventArgs | e |
OnUnloadingRow(DataGridRowEventArgs)
Raises the UnloadingRow event for row recycling.
Declaration
protected virtual void OnUnloadingRow(DataGridRowEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowEventArgs | e |
OnUnloadingRowDetails(DataGridRowDetailsEventArgs)
Raises the UnloadingRowDetails event
Declaration
protected virtual void OnUnloadingRowDetails(DataGridRowDetailsEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowDetailsEventArgs | e |
OnUnloadingRowGroup(DataGridRowGroupHeaderEventArgs)
Raises the UnLoadingRowGroup event
Declaration
protected virtual void OnUnloadingRowGroup(DataGridRowGroupHeaderEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DataGridRowGroupHeaderEventArgs | e | EventArgs |
ScrollIntoView(Object, DataGridColumn)
Scrolls the specified item or RowGroupHeader and/or column into view. If item is not null: scrolls the row representing the item into view; If column is not null: scrolls the column into view; If both item and column are null, the method returns without scrolling.
Declaration
public void ScrollIntoView(object item, DataGridColumn column)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | an item from the DataGrid's items source or a CollectionViewGroup from the collection view |
DataGridColumn | column | a column from the DataGrid's columns collection |
Events
| Improve this Doc View SourceAutoGeneratingColumn
Occurs one time for each public, non-static property in the bound data type when the ItemsSource property is changed and the AutoGenerateColumns property is true.
Declaration
public event EventHandler<DataGridAutoGeneratingColumnEventArgs> AutoGeneratingColumn
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridAutoGeneratingColumnEventArgs> |
BeginningEdit
Occurs before a cell or row enters editing mode.
Declaration
public event EventHandler<DataGridBeginningEditEventArgs> BeginningEdit
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridBeginningEditEventArgs> |
CellEditEnded
Occurs after cell editing has ended.
Declaration
public event EventHandler<DataGridCellEditEndedEventArgs> CellEditEnded
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridCellEditEndedEventArgs> |
CellEditEnding
Occurs immediately before cell editing has ended.
Declaration
public event EventHandler<DataGridCellEditEndingEventArgs> CellEditEnding
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridCellEditEndingEventArgs> |
ColumnDisplayIndexChanged
Occurs when the DisplayIndex property of a column changes.
Declaration
public event EventHandler<DataGridColumnEventArgs> ColumnDisplayIndexChanged
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridColumnEventArgs> |
ColumnHeaderDragCompleted
Occurs when the user drops a column header that was being dragged using the mouse.
Declaration
public event EventHandler<DragCompletedEventArgs> ColumnHeaderDragCompleted
Event Type
Type | Description |
---|---|
System.EventHandler<DragCompletedEventArgs> |
ColumnHeaderDragDelta
Occurs one or more times while the user drags a column header using the mouse.
Declaration
public event EventHandler<DragDeltaEventArgs> ColumnHeaderDragDelta
Event Type
Type | Description |
---|---|
System.EventHandler<DragDeltaEventArgs> |
ColumnHeaderDragStarted
Occurs when the user begins dragging a column header using the mouse.
Declaration
public event EventHandler<DragStartedEventArgs> ColumnHeaderDragStarted
Event Type
Type | Description |
---|---|
System.EventHandler<DragStartedEventArgs> |
ColumnReordered
Raised when column reordering ends, to allow subscribers to clean up.
Declaration
public event EventHandler<DataGridColumnEventArgs> ColumnReordered
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridColumnEventArgs> |
ColumnReordering
Raised when starting a column reordering action. Subscribers to this event can set tooltip and caret UIElements, constrain tooltip position, indicate that a preview should be shown, or cancel reordering.
Declaration
public event EventHandler<DataGridColumnReorderingEventArgs> ColumnReordering
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridColumnReorderingEventArgs> |
CopyingRowClipboardContent
This event is raised by OnCopyingRowClipboardContent method after the default row content is prepared. Event listeners can modify or add to the row clipboard content.
Declaration
public event EventHandler<DataGridRowClipboardEventArgs> CopyingRowClipboardContent
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowClipboardEventArgs> |
CurrentCellChanged
Occurs when a different cell becomes the current cell.
Declaration
public event EventHandler<EventArgs> CurrentCellChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
LoadingRow
Occurs after a DataGridRow is instantiated, so that you can customize it before it is used.
Declaration
public event EventHandler<DataGridRowEventArgs> LoadingRow
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowEventArgs> |
LoadingRowDetails
Occurs when a new row details template is applied to a row, so that you can customize the details section before it is used.
Declaration
public event EventHandler<DataGridRowDetailsEventArgs> LoadingRowDetails
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowDetailsEventArgs> |
LoadingRowGroup
Occurs before a DataGridRowGroupHeader header is used.
Declaration
public event EventHandler<DataGridRowGroupHeaderEventArgs> LoadingRowGroup
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowGroupHeaderEventArgs> |
PreparingCellForEdit
Occurs when a cell in a DataGridTemplateColumn enters editing mode.
Declaration
public event EventHandler<DataGridPreparingCellForEditEventArgs> PreparingCellForEdit
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridPreparingCellForEditEventArgs> |
RowDetailsVisibilityChanged
Occurs when the RowDetailsVisibilityMode property value changes.
Declaration
public event EventHandler<DataGridRowDetailsEventArgs> RowDetailsVisibilityChanged
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowDetailsEventArgs> |
RowEditEnded
Occurs when the row has been successfully committed or cancelled.
Declaration
public event EventHandler<DataGridRowEditEndedEventArgs> RowEditEnded
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowEditEndedEventArgs> |
RowEditEnding
Occurs immediately before the row has been successfully committed or cancelled.
Declaration
public event EventHandler<DataGridRowEditEndingEventArgs> RowEditEnding
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowEditEndingEventArgs> |
SelectionChanged
Occurs when the SelectedItem or SelectedItems property value changes.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type | Description |
---|---|
SelectionChangedEventHandler |
UnloadingRow
Occurs when a DataGridRow object becomes available for reuse.
Declaration
public event EventHandler<DataGridRowEventArgs> UnloadingRow
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowEventArgs> |
UnloadingRowDetails
Occurs when a row details element becomes available for reuse.
Declaration
public event EventHandler<DataGridRowDetailsEventArgs> UnloadingRowDetails
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowDetailsEventArgs> |
UnloadingRowGroup
Occurs when the DataGridRowGroupHeader is available for reuse.
Declaration
public event EventHandler<DataGridRowGroupHeaderEventArgs> UnloadingRowGroup
Event Type
Type | Description |
---|---|
System.EventHandler<DataGridRowGroupHeaderEventArgs> |