Skip to content

[release/11.0] Fix DataGridView losing the current cell after row removal - #15347

Merged
LeafShi1 merged 1 commit into
release/11.0from
backport/pr-15321-to-release/11.0
Nov 5, 2026
Merged

LeafShi1 merged 1 commit into
release/11.0from
backport/pr-15321-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #15321 to release/11.0

Fixes #15317

Root cause

A change in #12534 discarded the replacement current-cell address returned by the row-removal preparation logic and passed an invalid address to the subsequent notification instead.
The preparation logic clears the current cell when its row is removed. Without the replacement address, the post-removal logic cannot restore the current cell and selection

Proposed changes

  • Preserve the replacement current-cell address returned during row removal and pass it to the collection-change notification.
  • Restore the existing logic that updates the current cell and selection after removing a row.

Customer Impact

  • When a user deletes the current row of a DataGridView (bound or unbound), the next visible row becomes current after the current row is deleted, or the previous visible row when no suitable next row exists. The current column is preserved.

Regression?

Yes- regression PR #12534

Testing

  • Unit tests: five new regression cases.
  • Manual tests

Risk

@github-actions
github-actions Bot requested a review from a team as a code owner November 2, 2026 01:07
@LeafShi1 LeafShi1 added the servicing-approved .NET Shiproom approved the PR for merge label Nov 5, 2026
@LeafShi1

LeafShi1 commented Nov 5, 2026

Copy link
Copy Markdown
Member

Approved over email.

@LeafShi1
LeafShi1 merged commit 1fd6ea7 into release/11.0 Nov 5, 2026
8 checks passed
@LeafShi1
LeafShi1 deleted the backport/pr-15321-to-release/11.0 branch November 5, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

servicing-approved .NET Shiproom approved the PR for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants