Class DataGrid
Represents a customizable data grid control for displaying tabular data with support for headers, rows, and columns.
Assembly: MicroLayout.dll
View Source
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
public int RowHeight { get; set; }
HeaderRowHeight
Gets or sets the height, in pixels, of the header row in the table.
View Source
public int HeaderRowHeight { get; set; }
RowCount
Gets the number of data rows currently stored in the collection.
View Source
public int RowCount { get; }
Columns
Gets the collection of column definitions for the current layout.
View Source
public DataGrid.ColumnDefinition[] Columns { get; }
HeaderBackgroundColor
Gets or sets the background color of the header.
View Source
public Color HeaderBackgroundColor { get; set; }
HeaderTextColor
Gets or sets the color of the header text.
View Source
public Color HeaderTextColor { get; set; }
EvenRowBackgroundColor
Gets or sets the background color for even rows in a table or grid.
View Source
public Color? EvenRowBackgroundColor { get; set; }
EvenRowTextColor
Gets or sets the text color for even rows in a display or grid.
View Source
public Color? EvenRowTextColor { get; set; }
RowFont
Gets or sets the font used to render data rows in the table.
View Source
public IFont? RowFont { get; set; }
HeaderFont
Gets or sets the font used for rendering headers.
View Source
public IFont? HeaderFont { get; set; }
TextColor
Gets or sets the text color of the label text.
View Source
public Color TextColor { get; set; }
BackgroundColor
Gets or sets the background color of the label display control.
View Source
public Color BackgroundColor { get; set; }
Methods
AddRow(params object[])
Adds a new row to the collection with the specified values.
View Source
public void AddRow(params object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
System.Object[] | values | An 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
public void InsertRow(int index, params object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | index | The zero-based index at which the new row should be inserted. Must be within the range of existing rows. |
System.Object[] | values | An 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
public void RemoveRow(int index)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | index | The 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
public void UpdateCell(int rowIndex, int columnIndex, object value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | rowIndex | The zero-based index of the row containing the cell to update. Must be within the valid range of rows. |
System.Int32 | columnIndex | The zero-based index of the column containing the cell to update. Must be within the valid range of columns. |
System.Object | value | The 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
protected override void OnDraw(MicroGraphics graphics)
Parameters
| Type | Name | Description |
|---|---|---|
| Meadow.Foundation.Graphics.MicroGraphics | graphics | The Meadow.Foundation.Graphics.MicroGraphics surface to draw the control on. |