DataGrid Properties
The properties of the DataGrid class are listed here. For a complete list of DataGrid class members, see the DataGrid Members topic.
Public Properties
AccessibilityObject (inherited from Control) | Gets the AccessibleObject assigned to the control. |
AccessibleDefaultActionDescription (inherited from Control) | Gets or sets the default action description of the control for use by accessibility client applications. |
AccessibleDescription (inherited from Control) | Gets or sets the description of the control used by accessibility client applications. |
AccessibleName (inherited from Control) | Gets or sets the name of the control used by accessibility client applications. |
AccessibleRole (inherited from Control) | Gets or sets the accessible role of the control |
AllowDrop (inherited from Control) | Gets or sets a value indicating whether the control can accept data that the user drags onto it. |
AllowNavigation | Gets or sets a value indicating whether navigation is allowed. |
AllowSorting | Gets or sets a value indicating whether the grid can be resorted by clicking on a column header. |
AlternatingBackColor | Gets or sets the background color of odd-numbered rows of the grid. |
Anchor (inherited from Control) | Gets or sets which edges of the control are anchored to the edges of its container. |
BackColor Supported by the .NET Compact Framework. | Overridden. Gets or sets the background color of even-numbered rows of the grid. |
BackgroundColor | Gets or sets the color of the non-row area of the grid. |
BackgroundImage | Overridden. See Control.BackgroundImage. |
BindingContext (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the BindingContext for the control. |
BorderStyle | Gets or sets the grid's border style. |
Bottom (inherited from Control) | Gets the distance, in pixels, between the bottom edge of the control and the top edge of its container's client area. |
Bounds (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the size and location of the control including its nonclient elements. |
CanFocus (inherited from Control) | Gets a value indicating whether the control can receive focus. |
CanSelect (inherited from Control) | Gets a value indicating whether the control can be selected. |
CaptionBackColor | Gets or sets the background color of the caption area. |
CaptionFont | Gets or sets the font of the grid's caption. |
CaptionForeColor | Gets or sets the foreground color of the caption area. |
CaptionText | Gets or sets the text of the grid's window caption. |
CaptionVisible | Gets or sets a value that indicates whether the grid's caption is visible. |
Capture (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets a value indicating whether the control has captured the mouse. |
CausesValidation (inherited from Control) | Gets or sets a value indicating whether the control causes validation to be performed on any controls that require validation when it receives focus. |
ClientRectangle (inherited from Control)
Supported by the .NET Compact Framework. | Gets the rectangle that represents the client area of the control. |
ClientSize (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the height and width of the client area of the control. |
ColumnHeadersVisible Supported by the .NET Compact Framework. | Gets or sets a value indicating whether the column headers a table are visible. |
CompanyName (inherited from Control) | Gets the name of the company or creator of the application containing the control. |
Container (inherited from Component) | Gets the IContainer that contains the Component. |
ContainsFocus (inherited from Control) | Gets a value indicating whether the control, or one of its child controls, currently has the input focus. |
ContextMenu (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the shortcut menu associated with the control. |
Controls (inherited from Control)
Supported by the .NET Compact Framework. | Gets the collection of controls contained within the control. |
Created (inherited from Control) | Gets a value indicating whether the control has been created. |
CurrentCell Supported by the .NET Compact Framework. | Gets or sets which cell has the focus. Not available at design time. |
CurrentRowIndex Supported by the .NET Compact Framework. | Gets or sets index of the selected row. |
Cursor | Overridden. See Control.Cursor. |
DataBindings (inherited from Control)
Supported by the .NET Compact Framework. | Gets the data bindings for the control. |
DataMember | Gets or sets the specific list in a DataSource for which the System.Windows.Forms.DataGrid control displays a grid. |
DataSource Supported by the .NET Compact Framework. | Gets or sets the data source that the grid is displaying data for. |
DisplayRectangle (inherited from Control) | Gets the rectangle that represents the display area of the control. |
Disposing (inherited from Control) | Gets a value indicating whether the control is in the process of being disposed of. |
Dock (inherited from Control) | Gets or sets which edge of the parent container a control is docked to. |
Enabled (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets a value indicating whether the control can respond to user interaction. |
FirstVisibleColumn Supported by the .NET Compact Framework. | Gets the index of the first visible column in a grid. |
FlatMode | Gets or sets a value indicating whether the grid displays in flat mode. |
Focused (inherited from Control)
Supported by the .NET Compact Framework. | Gets a value indicating whether the control has input focus. |
Font (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the font of the text displayed by the control. |
ForeColor Supported by the .NET Compact Framework. | Overridden. Gets or sets the foreground color (typically the color of the text) property of the System.Windows.Forms.DataGrid control. |
GridLineColor Supported by the .NET Compact Framework. | Gets or sets the color of the grid lines. |
GridLineStyle | Gets or sets the line style of the grid. |
Handle (inherited from Control) | Gets the window handle that the control is bound to. |
HasChildren (inherited from Control) | Gets a value indicating whether the control contains one or more child controls. |
HeaderBackColor Supported by the .NET Compact Framework. | Gets or sets the background color of all row and column headers. |
HeaderFont | Gets or sets the font used for column headers. |
HeaderForeColor Supported by the .NET Compact Framework. | Gets or sets the foreground color of headers. |
Height (inherited from Control) | Gets or sets the height of the control. |
ImeMode (inherited from Control) | Gets or sets the Input Method Editor (IME) mode of the control. |
InvokeRequired (inherited from Control) | Gets a value indicating whether the caller must call an invoke method when making method calls to the control because the caller is on a different thread than the one the control was created on. |
IsAccessible (inherited from Control) | Gets or sets a value indicating whether the control is visible to accessibility applications. |
IsDisposed (inherited from Control) | Gets a value indicating whether the control has been disposed of. |
IsHandleCreated (inherited from Control) | Gets a value indicating whether the control has a handle associated with it. |
Item | Overloaded. Gets or sets the value of a specified cell.
In C#, this property is the indexer for the DataGrid class. |
Left (inherited from Control) | Gets or sets the distance, in pixels, between the left edge of the control and the left edge of its container's client area. |
LinkColor | Gets or sets the color of the text that you can click to navigate to a child table. |
LinkHoverColor | Gets or sets the color a link changes to when the mouse pointer moves over it. |
Location (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container. |
Name (inherited from Control) | Gets or sets the name of the control. |
Parent (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the parent container of the control. |
ParentRowsBackColor | Gets or sets the background color of parent rows. |
ParentRowsForeColor | Gets or sets the foreground color of parent rows. |
ParentRowsLabelStyle | Gets or sets the way parent row labels are displayed. |
ParentRowsVisible | Gets or sets a value indicating whether the parent rows of a table are visible. |
PreferredColumnWidth | Gets or sets the default width of the grid columns in pixels. |
PreferredRowHeight | Gets or sets the preferred row height for the System.Windows.Forms.DataGrid control. |
ProductName (inherited from Control) | Gets the product name of the assembly containing the control. |
ProductVersion (inherited from Control) | Gets the version of the assembly containing the control. |
ReadOnly | Gets or sets a value indicating whether the grid is in read-only mode. |
RecreatingHandle (inherited from Control) | Gets a value indicating whether the control is currently re-creating its handle. |
Region (inherited from Control) | Gets or sets the window region associated with the control. |
Right (inherited from Control) | Gets the distance, in pixels, between the right edge of the control and the left edge of its container's client area. |
RightToLeft (inherited from Control) | Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts. |
RowHeadersVisible Supported by the .NET Compact Framework. | Gets or sets a value that specifies whether row headers are visible. |
RowHeaderWidth | Gets or sets the width of row headers. |
SelectionBackColor Supported by the .NET Compact Framework. | Gets or sets the background color of selected rows. |
SelectionForeColor Supported by the .NET Compact Framework. | Gets or set the foreground color of selected rows. |
Site | Overridden. See Control.Site. |
Size (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets the height and width of the control. |
TabIndex (inherited from Control) | Gets or sets the tab order of the control within its container. |
TableStyles Supported by the .NET Compact Framework. | Gets the collection of DataGridTableStyle objects for the grid. |
TabStop (inherited from Control) | Gets or sets a value indicating whether the user can give the focus to this control using the TAB key. |
Tag (inherited from Control) | Gets or sets the object that contains data about the control. |
Text Supported by the .NET Compact Framework. | Overridden. See Control.Text. |
Top (inherited from Control) | Gets or sets the distance, in pixels, between the bottom edge of the control and the top edge of its container's client area. |
TopLevelControl (inherited from Control)
Supported by the .NET Compact Framework. | Gets the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in. |
Visible (inherited from Control)
Supported by the .NET Compact Framework. | Gets or sets a value indicating whether the control is displayed. |
VisibleColumnCount Supported by the .NET Compact Framework. | Gets the number of visible columns. |
VisibleRowCount Supported by the .NET Compact Framework. | Gets the number of rows visible. |
Width (inherited from Control) | Gets or sets the width of the control. |
Protected Properties
CreateParams (inherited from Control) | Gets the required creation parameters when the control handle is created. |
DefaultImeMode (inherited from Control) | Gets the default Input Method Editor (IME) mode supported by the control. |
DefaultSize | Overridden. Gets the default size of the control. |
DesignMode (inherited from Component) | Gets a value that indicates whether the Component is currently in design mode. |
Events (inherited from Component) | Gets the list of event handlers that are attached to this Component. |
FontHeight (inherited from Control) | Gets or sets the height of the font of the control. |
HorizScrollBar | Gets the horizontal scrollbar for the grid. |
ListManager | Gets the CurrencyManager for this System.Windows.Forms.DataGrid control. |
ResizeRedraw (inherited from Control) | Gets or sets a value indicating whether the control redraws itself when resized. |
ShowFocusCues (inherited from Control) | Gets a value indicating whether the control should display focus rectangles. |
ShowKeyboardCues (inherited from Control) | Gets a value indicating whether the control should display keyboard shortcuts. |
VertScrollBar | Gets the vertical scroll bar of the control. |
