Skip to content

Provide suitable DataRow behavior when DataTable is not present#784

Open
9rnsr wants to merge 2 commits intoCommunityToolkit:mainfrom
9rnsr:ImproveDataTable-3
Open

Provide suitable DataRow behavior when DataTable is not present#784
9rnsr wants to merge 2 commits intoCommunityToolkit:mainfrom
9rnsr:ImproveDataTable-3

Conversation

@9rnsr
Copy link
Copy Markdown
Contributor

@9rnsr 9rnsr commented Feb 23, 2026

Separate PR from #781

This added behavior just covers a corner case. If a user fails to place corresponding DataTable at correct position, displaying somethings is better than nothing.

Each rows layout their columns independent, because there's no main controller to remember the column widths, and then it looks like a horizontal StackPanel.
If there's no main controller to remember the column widths, each DataRow uses the full width of its parent element to provide equal widths to its child elements.

@9rnsr 9rnsr force-pushed the ImproveDataTable-3 branch 2 times, most recently from 3933681 to 371b6d9 Compare April 25, 2026 01:12
@michael-hawker
Copy link
Copy Markdown
Member

Was thinking about this scenario a bit more over the weekend, and I see a couple of directions:

  1. If they just have a DataRow it's better to just have another panel there instead if they don't intend to use it as it's intended. Providing another behavior may be confusing or not lead them to understanding that there's more to be done. Probably something to think about if we can indicate this different state another way.

  2. If we did want a default behavior. Probably doing a more EqualPanel type behavior where we space each item out based on the available width / number of items would make more sense, as then as long as the developer has the same number of items in each row (which they would with a data template) then it evenly spaces each item and maintains columns between the rows compared to them being jagged.

@9rnsr
Copy link
Copy Markdown
Contributor Author

9rnsr commented Apr 29, 2026

The jagged layout of each row is exactly what I intended, because it can strongly recommend that the DataRow control is being used incorrectly.

…But, as you pointed out, there’s less real practical benefit to that behavior, and I can admit that your idea is more practical. I’ll update the default behavior so that each child element in the DataRow is given an equal width.

9rnsr added 2 commits April 29, 2026 14:19
…ld elements

This added behavior just covers a corner case. If a user fails to place corresponding DataTable at correct position, displaying somethings is better than nothing.

If there's no main controller to remember the column widths, each DataRow uses the full width of its parent element to provide equal widths to its child elements.
@9rnsr 9rnsr force-pushed the ImproveDataTable-3 branch from 371b6d9 to 0bff904 Compare April 29, 2026 05:19
@9rnsr 9rnsr changed the title DataRow lay out children like a horizontal StackPanel if DataTable is not present Provide suitable DataRow behavior when DataTable is not present Apr 29, 2026
@9rnsr
Copy link
Copy Markdown
Contributor Author

9rnsr commented Apr 29, 2026

Updated. To check the new DataRow behavior, I added a sample.

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