Skip to main content

Class DataGrid

Represents a customizable data grid control for displaying tabular data with support for headers, rows, and columns.

Assembly: MicroLayout.dll​
View Source​
Declaration
public class DataGrid : ThemedControl, IThemedControl, IControl

Inheritance: System.Object -> Meadow.Foundation.Graphics.MicroLayout.Control -> Meadow.Foundation.Graphics.MicroLayout.ThemedControl

Implements:
Meadow.Foundation.Graphics.MicroLayout.IThemedControl, Meadow.Foundation.Graphics.MicroLayout.IControl

Properties​

RowHeight​

Gets or sets the height, in pixels, of a row in the grid.

View Source​
Declaration
public int RowHeight { get; set; }

HeaderRowHeight​

Gets or sets the height, in pixels, of the header row in the table.

View Source​
Declaration
public int HeaderRowHeight { get; set; }

RowCount​

Gets the number of data rows currently stored in the collection.

View Source​
Declaration
public int RowCount { get; }

Columns​

Gets the collection of column definitions for the current layout.

View Source​
Declaration
public DataGrid.ColumnDefinition[] Columns { get; }

HeaderBackgroundColor​

Gets or sets the background color of the header.

View Source​
Declaration
public Color HeaderBackgroundColor { get; set; }

HeaderTextColor​

Gets or sets the color of the header text.

View Source​
Declaration
public Color HeaderTextColor { get; set; }

EvenRowBackgroundColor​

Gets or sets the background color for even rows in a table or grid.

View Source​
Declaration
public Color? EvenRowBackgroundColor { get; set; }

EvenRowTextColor​

Gets or sets the text color for even rows in a display or grid.

View Source​
Declaration
public Color? EvenRowTextColor { get; set; }

RowFont​

Gets or sets the font used to render data rows in the table.

View Source​
Declaration
public IFont? RowFont { get; set; }

HeaderFont​

Gets or sets the font used for rendering headers.

View Source​
Declaration
public IFont? HeaderFont { get; set; }

TextColor​

Gets or sets the text color of the label text.

View Source​
Declaration
public Color TextColor { get; set; }

BackgroundColor​

Gets or sets the background color of the label display control.

View Source​
Declaration
public Color BackgroundColor { get; set; }

Methods​

AddRow(params object[])​

Adds a new row to the collection with the specified values.

View Source​
Declaration
public void AddRow(params object[] values)
Parameters​
TypeNameDescription
System.Object[]valuesAn array of values to populate the new row. The number of values must not exceed the number of columns.

InsertRow(int, params object[])​

Inserts a new row at the specified index with the provided values.

View Source​
Declaration
public void InsertRow(int index, params object[] values)
Parameters​
TypeNameDescription
System.Int32indexThe zero-based index at which the new row should be inserted. Must be within the range of existing rows.
System.Object[]valuesAn array of values to populate the new row. The number of values must not exceed the number of columns.
Exceptions​

System.ArgumentOutOfRangeException
Thrown if <code class="paramref">index</code> is less than 0 or greater than the current number of rows.

RemoveRow(int)​

Removes the row at the specified index from the collection.

View Source​
Declaration
public void RemoveRow(int index)
Parameters​
TypeNameDescription
System.Int32indexThe zero-based index of the row to remove. Must be within the valid range of the collection.
Exceptions​

System.ArgumentOutOfRangeException
Thrown if <code class="paramref">index</code> is less than 0 or greater than or equal to the number of rows in the collection.

UpdateCell(int, int, object)​

Updates the value of a specific cell in the grid.

View Source​
Declaration
public void UpdateCell(int rowIndex, int columnIndex, object value)
Parameters​
TypeNameDescription
System.Int32rowIndexThe zero-based index of the row containing the cell to update. Must be within the valid range of rows.
System.Int32columnIndexThe zero-based index of the column containing the cell to update. Must be within the valid range of columns.
System.ObjectvalueThe new value to assign to the specified cell.
Exceptions​

System.ArgumentOutOfRangeException
Thrown if <code class="paramref">rowIndex</code> is less than 0, greater than or equal to the number of rows, or if <code class="paramref">columnIndex</code> is less than 0 or greater than or equal to the number of columns.

OnDraw(MicroGraphics)​

Performs the actual drawing of the control on the specified Meadow.Foundation.Graphics.MicroGraphics surface. This method must be implemented in derived classes.

View Source​
Declaration
protected override void OnDraw(MicroGraphics graphics)
Parameters​
TypeNameDescription
Meadow.Foundation.Graphics.MicroGraphicsgraphicsThe Meadow.Foundation.Graphics.MicroGraphics surface to draw the control on.

Implements​