Skip to content

Add column width sharing across grids#315

Open
wieslawsoltes wants to merge 8 commits into
masterfrom
agent/issue-295-column-width-sharing
Open

Add column width sharing across grids#315
wieslawsoltes wants to merge 8 commits into
masterfrom
agent/issue-295-column-width-sharing

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class DataGrid column-width sharing across multiple grids, analogous to Grid.SharedSizeGroup/scope usage.

  • introduces an explicit weak-reference DataGridColumnWidthSharingScope
  • introduces DataGridColumnWidthSharing.Group for direct XAML columns
  • adds DataGrid.ColumnWidthSharingScope and DataGridColumnDefinition.WidthSharingGroup
  • synchronizes initial widths and propagates automatic, programmatic, user, inherited, and redistribution changes
  • tracks collection, group, scope, measurement, and visual-attachment lifecycle transitions
  • documents compiled-binding/MVVM and direct XAML usage

Design

The implementation is instance-scoped with no global registry. A reentrancy guard prevents recursive broadcasts while widths are applied through the existing no-callback API.

Sizing behavior is explicit:

  • pixel columns remain pixel columns;
  • intrinsic auto modes retain their mode while sharing desired/display width;
  • measured star results normalize to pixels because different grids cannot reliably share one star result;
  • unresolved stars are deferred entirely—including their provisional constraints—until measurement completes;
  • overlapping constraints produce a common clamped width, while incompatible constraints clamp each participant independently.

Definition changes use the live materialization pipeline, so group updates do not rebuild the grid.

Review hardening

Follow-up fixes cover:

  • inherited width preservation;
  • registration refresh and identity-safe scope migration while detached;
  • active-width adoption on reattach, preventing stale detached widths from winning;
  • rejection of reports from pruned/nonparticipants;
  • first-measure reporting for deferred stars;
  • indirect non-star/star redistribution, normalization, and min/max side-effect reports;
  • consistent exclusion of unresolved stars from both target assignment and common constraint aggregation.

Validation

  • Focused width-sharing suite: 17 passed, 0 failed.
  • Full Avalonia.Controls.DataGrid.UnitTests: 2,267 passed, 0 failed.
  • Release leak suite: 34 passed, 0 failed.
  • git diff --check: clean.
  • All review threads resolved.

Fixes #295

@wieslawsoltes

Copy link
Copy Markdown
Owner Author

Self-review completed. I reviewed scope registration, weak-reference cleanup, group changes, constraint handling, width-mode preservation, and tests; no additional actionable findings were found. All six CI checks are successful, the branch is synchronized, and git diff --check is clean. This PR is ready for review.

@wieslawsoltes
wieslawsoltes marked this pull request as ready for review July 15, 2026 00:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b172fbf17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Avalonia.Controls.DataGrid/Sizing/DataGridColumnWidthSharingScope.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d0e9acb76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Avalonia.Controls.DataGrid/DataGrid.Columns.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e718204ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b4c58088e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1323daeefc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Avalonia.Controls.DataGrid/Sizing/DataGridColumnWidthSharingScope.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5ee42fd3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Avalonia.Controls.DataGrid/Sizing/DataGridColumnWidthSharingScope.cs Outdated
Comment thread src/Avalonia.Controls.DataGrid/DataGrid.Columns.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f8b932c7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Avalonia.Controls.DataGrid/Sizing/DataGridColumnWidthSharingScope.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid column-width sharing

1 participant