-
Notifications
You must be signed in to change notification settings - Fork 81
WrapPanel2 Component Creation #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Demo Video StretchPanel-Demo1.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Avid29, great start! I just dropping a couple of quick comments.
There's a few option combinations/scenarios that I may be a bit confused on still with how stretching works, maybe it has to do when both children in a row have a specific fixed size, as it's weird to see them not always be that fixed size. Though I know the video is a little out-of-date too, so not sure if that's a factor.
Not sure if it needs to be part of the doc or some other aspect, but I think it'll be good for us to enumerate a bunch of various settings and scenarios and how we expect their behavior to react to layout and see how that matches up with our expectations on various settings and such. Then we can encode those results in the docs/examples/tests.
(This can be an ongoing process too, as we gather feedback.)
michael-hawker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments based on the WrapPanel WinUI API review/direction.
| /// <summary> | ||
| /// Backing <see cref="DependencyProperty"/> for the <see cref="LineSpacing"/> property. | ||
| /// </summary> | ||
| public static readonly DependencyProperty lineSpacingProperty = DependencyProperty.Register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missed first capital letter
| Equal, | ||
|
|
||
| /// <summary> | ||
| /// In a row without star-sized items, each item will be stretched proportional to their desired size to fill the row. | ||
| /// </summary> | ||
| Proportional, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From discussion here: microsoft/microsoft-ui-xaml#10858 (comment)
We're updating to ItemsStretch to match UniformGridLayout. Their enum has Uniform and Fill which I think would be analogs to these defined here, which could be good to match.
Still trying to think about how we reconcile None in the base implementation (i.e. so that this was purely a drop-in replacement when stable). My gut is that None is the StarSizedOnly that we don't have to change that as overriding the attached property to get that behavior is the change in behavior itself... (e.g. in most games, you follow the default rules unless told otherwise, the attached property is a told otherwise extension here basically... [even if the panel is the thing that has to be aware in the implementation, that's an implementation detail])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I see what you mean. I suppose the proper thing to do is name according to the simplest use case and document the extraordinary case as plainly as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is making me think I should also change the behavior of the ItemJustification property to adjust the margins when ItemsStretch is None. I'll do that in another commit after I address the simple changes. I'm actually really happy with that addition to the API as well.
| /// <summary> | ||
| /// Gets or sets whether or not all rows/columns should stretch to match the length of the longest. | ||
| /// </summary> | ||
| public bool FixedRowLengths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the equivalent of ItemsJustification, is that the direction we should move toward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only hesitation was that "justification" is defined by stretching items to touch the margin on both ends. Technically this is not the case unless the main axis stretch is also "Stretch".
Although, since this property applies to the arrange step and not the measure step, arguably the margin is the measured size.
I'll add that rename to my commit addressing your comments, but I'm going to stick with a boolean for now. Especially since that enum seems to have two values with the same description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, enum is here has 6 values: https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.uniformgridlayoutitemsjustification - even if we only have two for now an enum allows us to add more or change it more easily in the future than a bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I see that. I'm just not sure what the difference between SpaceEvenly and SpaceAround is. They have the same description.
| /// <summary> | ||
| /// Gets or sets the method used to fill rows without a star-sized item. | ||
| /// </summary> | ||
| public StretchChildren StretchChildren |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion here: microsoft/microsoft-ui-xaml#10858 (comment)
We're updating to ItemsStretch to match UniformGridLayout.
| /// <summary> | ||
| /// Items which do not fit within the available space will be removed from the layout. | ||
| /// </summary> | ||
| Drop, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a scenario/need for this? I'm just curious as it's adding a whole extra property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a potential use case when I was writing this, but I wasn't actually happy with it when I plugged it in. I'll remove the property.
…retching items when ItemsStretch is none.
|
Cool, |
Hmm. Maybe worth leaving a remark on both properties, but definitely should be a remark for |



Introduces the first draft of the
WrapPanel2.Resolves: #763 as discussed in #762.