Provide suitable DataRow behavior when DataTable is not present#784
Provide suitable DataRow behavior when DataTable is not present#7849rnsr wants to merge 2 commits intoCommunityToolkit:mainfrom
Conversation
3933681 to
371b6d9
Compare
|
Was thinking about this scenario a bit more over the weekend, and I see a couple of directions:
|
|
The jagged layout of each row is exactly what I intended, because it can strongly recommend that the …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 |
…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.
371b6d9 to
0bff904
Compare
|
Updated. To check the new |
michael-hawker
left a comment
There was a problem hiding this comment.
Few small comments. @niels9001 any thoughts on this as a default partial behavior?
| return new Size(0, finalSize.Height); | ||
|
|
||
| double x = 0; | ||
| double width = finalSize.Width / Children.Count; |
There was a problem hiding this comment.
We need the visible child count here otherwise we'll make everything smaller and not take up the full width, we can cache this from the measure step.
|
|
||
| if (Children.Count > 0) | ||
| // If we don't have a grid, provides equal widths to child elements. | ||
| if (_parentPanel is null) |
There was a problem hiding this comment.
For both the measure and arrange bit we should probably abstract these to sub-methods to just make it a bit easier to contain.
|
|
||
| <!-- no DataTable in <ListView.Header> --> | ||
|
|
||
| <ListView.ItemTemplate> |
There was a problem hiding this comment.
Sample is nice here thanks, this does seem like a useful base scenario, though someone could just use an EqualPanel here just as easily, it does extend itself later to just adding the rest of the pattern if needed.
| <!--<ListView.ItemContainerStyle> | ||
| <Style BasedOn="{StaticResource DefaultListViewItemStyle}" | ||
| TargetType="ListViewItem"> | ||
| <Setter Property="HorizontalContentAlignment" Value="Left" /> | ||
| </Style> | ||
| </ListView.ItemContainerStyle>--> |
Separate PR from #781
This added behavior just covers a corner case. If a user fails to place corresponding
DataTableat 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 horizontalStackPanel.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.