Form

GPALDataGridView

Everything on Settings Every Control Takes applies here too. GPAL.DataGridView builds one. WithInput takes an IGPALGrid, a DataTable, an IGPALDatabase whose query it runs, or a GPALFile it tokenizes, and the column names come from the source. WithColumns names them instead, and WithAutoGenerateColumns lets the grid build them from the data. WithColumnWidth takes pixel widths in column order, or shares as doubles which reflow with the form. WithStartRow, WithEndRow, WithStartColumn and WithEndColumn bound what GetGrid reads back out, not what the grid displays. They are one-based, and a value of zero or less means no bound on that side. WithReadOnly stops the user editing cells. GetGrid reads the contents back out as an IGPALGrid, including anything the user typed. CellValueChanged is the event for an edit. GPAL.DataGridViewFor(columns) is the shorthand.

Examples

GPAL Fluent: High-level fluent C# API

//The last column takes whatever width the others leave, so the row ends at the edge of the control rather than leaving a strip that is not a column.

GPALDataGridView rows = (GPALDataGridView)GPAL.DataGridView

.WithInput(orders)

.WithColumnWidth(0.4, 0.3, 0.3)

.WithReadOnly(false)

.WithCallback<DataGridViewCellEventHandler>(CellEdited).ForEvent(ControlEventType.CellValueChanged)

.WithName("rows");


// after the form closes, read back what the user left

rows.GetGrid(out IGPALGrid<string> edited);

💬 Ask GPAL