Skip to content

Comments

Improve DataTable control#781

Open
9rnsr wants to merge 12 commits intoCommunityToolkit:mainfrom
9rnsr:ImproveDataTable
Open

Improve DataTable control#781
9rnsr wants to merge 12 commits intoCommunityToolkit:mainfrom
9rnsr:ImproveDataTable

Conversation

@9rnsr
Copy link

@9rnsr 9rnsr commented Feb 19, 2026

  • Update layout logic to improve the support quality of mixing Auto, Star, and Absolute sized columns. And, for Auto and Star columns, distinguish the two states between auto-calculated widths and manually resized ones (the later would work like absolute sized columns in layout logic).
  • Set DataColumn.IsTabStop false (an issue in here)
  • Consider DataColumn.Visibility in the layout logic.

And I removed the hybrid-case support (DataTableHybridSample). As I commented here, it would not work on Auto columns as expected, so we should use the pair of DataTable and DataRow always.

9rnsr added 10 commits February 19, 2026 16:40
…r DataTable

The removed logic would have been useless or more harmful, because of the reasons:
1) DataTable control is designed to represent 'header' of a table, not for containing the list of DataRows.
2) Grid control is often used to lay out other controls rather than constructing a table, so there was possibilities that completely unrelated Grids would have been caught as a parent.
That case doesn't work well for the Width="Auto" column.
I'd like to make DataTable control simple rather than leave the pitfall.
From the design concept, DataColumn control simply provides a space for the header content, so it should not interact with keyboard operations by default. If something requested, the DataTable user could be place any controls like a Button there.
… not present

Each rows lay out their columns independent, because there's no main controller to remember the column widths.
The internal column types are increased to 5:
1. IsAbsolute:  have a width that is same with DesiredWidth, or a manually resized.
2. IsAuto: have a manually resized width.
3. IsStar: have a manually resized width.
4. IsAutoFit: have a calculated width that fits to each column content of visualized row.
5. IsStarProportion: have a calculated width, from the proportion of remained spaces.

DataTable assigns the width space first to 1-3, then 4-5. But, to take the actual width of 4 would need the Measure of visualized rows, so DataTable and DataRows would have mutual call of InvalidateMeasure. When the layout system is being into stable, that loop will be break.
@9rnsr
Copy link
Author

9rnsr commented Feb 19, 2026

@dotnet-policy-service agree

@michael-hawker
Copy link
Member

Thanks @9rnsr for this PR, DataTable certainly needs a bit of love, so appreciate you diving in! There's a lot of different pieces changed here (including some formatting and variable renames) which makes it a bit tricky to review.

Do you think you could do some of the following to boost this PR/process up a bit for us?

  • Split things out into smaller focused changes that fix one issue at a time
  • Further describe here in the PR notes to breakdown some of the changes before and after with examples/pictures/further explanation of changes (and how that relates to the specific code sections changed)
  • Add small specific-scenario tests to demonstrate the new/fixed/desired behaviors

Thanks!

@9rnsr
Copy link
Author

9rnsr commented Feb 23, 2026

@michael-hawker Thanks for your quick review. To make the review process more speedy, I'll split each commits into separate PR.

@9rnsr
Copy link
Author

9rnsr commented Feb 24, 2026

@michael-hawker I opened independent smaller PRs #782, #783, and #784.

@9rnsr
Copy link
Author

9rnsr commented Feb 24, 2026

@michael-hawker I opened two more PRs, #786 and #787.

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