Skip to content

Port DataGridView control from WinForms to Modern.Forms#121

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/port-datagridview-to-modernforms
Draft

Port DataGridView control from WinForms to Modern.Forms#121
Copilot wants to merge 5 commits intomainfrom
copilot/port-datagridview-to-modernforms

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

  • Fix edit TextBox positioned at wrong coordinates (device vs logical units)
  • Fix TextBox hidden under cell contents: swap paint order in DataGridView.OnPaint so RenderManager.Render runs before base.OnPaint (children composited on top)
  • Fix TextBox not moving on scroll: add UpdateEditTextBoxPosition() helper; call from both scroll ValueChanged handlers; cancel edit if cell scrolls out of view


if (sortOrder == SortOrder.Ascending) {
path.MoveTo (glyph_x, glyph_y + glyph_size);
path.LineTo (glyph_x + glyph_size / 2, glyph_y);
path.Close ();
} else {
path.MoveTo (glyph_x, glyph_y);
path.LineTo (glyph_x + glyph_size / 2, glyph_y + glyph_size);
Comment on lines +577 to +579
foreach (var col in Columns)
if (col.Visible)
total += LogicalToDeviceUnits (col.Width);
Comment on lines +396 to +403
if (e.KeyCode == Keys.Down) {
if (selected_row_index < Rows.Count - 1) {
SelectedRowIndex = selected_row_index + 1;
EnsureRowVisible (selected_row_index);
e.Handled = true;
return;
}
}
Comment on lines +405 to +412
if (e.KeyCode == Keys.Up) {
if (selected_row_index > 0) {
SelectedRowIndex = selected_row_index - 1;
EnsureRowVisible (selected_row_index);
e.Handled = true;
return;
}
}
Copilot AI and others added 2 commits April 8, 2026 03:05
…, and cell editing

- Fix visual artifacts at fractional DPI by using Math.Ceiling in GetContentArea
- Fix cursor not updating during mouse move by calling FindForm()?.SetCursor()
- Implement actual data sorting when column headers are clicked (numeric + string)
- Add DataSource property for data binding (auto-generates columns from properties)
- Add cell editing via double-click/F2 with embedded TextBox
- Add LostFocus event to Control, SelectAll() to TextBox
- Add CellBeginEdit, CellEndEdit, CellValueChanged events
- Add ReadOnly property, BeginEdit/EndEdit/CancelEdit methods
- Update ControlGallery to demonstrate data binding and editing

Agent-Logs-Url: https://github.com/modern-forms/Modern.Forms/sessions/d15aa0dc-cb46-4825-be39-974d7172db65

Co-authored-by: jpobst <179295+jpobst@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants