-
Notifications
You must be signed in to change notification settings - Fork 80
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
Refactor: Adaptive Column Width for StaggeredLayout #371
Refactor: Adaptive Column Width for StaggeredLayout #371
Conversation
Seems like we should maybe put this functionality behind a flag? The current non-adaptive behavior of the |
maybe like |
@Poker-sang there's a comment for
Does the existing setup not allow for this scenario in this case? Otherwise wondering if that'd be the hook to look for? |
Ah, @Poker-sang I see now, it's a comment left over from the
As it was the original template for the conversion to the Layout. Panels have their own alignment property, but Layouts don't. So, indeed we need some configuration here for this. |
Sounds good. But since it's also unlikely that we'll be able to directly use |
Oh, just make our own enum for use, better future proofing that way, and works better for fitting in with expectations for values for the property since it's similar to other ones. |
|
Thanks @Poker-sang, mind just adding a property to the sample page, so that we can show the difference there as well? You can see a similar example for the UnifomGrid here:
Just need to add an x:Bind function (see below in that file) and the binding in the XAML. (@Arlodotexe looks like no default is selected for these for the ComboBox?) |
I've added the example. But I don't know what's wrong with xaml style. |
I couldn't see on the CI which files failed, it's only showing the passing ones for some reason. But if you run the PowerShell script in the repo root, it should be able to fix them:
@Arlodotexe we should ensure we have the notes in the wiki about this script as well as a screenshot about the XAML Styler extension setting to search up the directory path: |
ok i will try it |
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.
Code changes look good. Pulled and tested under Uwp, Wasm and Wasdk and found no issues. Let's merge!
if (ItemsStretch is StaggeredLayoutItemsStretch.None) | ||
{ | ||
columnWidth = double.IsNaN(DesiredColumnWidth) ? availableWidth : Math.Min(DesiredColumnWidth, availableWidth); | ||
numColumns = Math.Max(1, (int)Math.Floor(availableWidth / state.ColumnWidth)); |
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.
🦙 Leaving a marker here for historical record/the future that we had missed the state.ColumnWidth
here not being the desired value of columnWidth
calculated above, as @Poker-sang
called out here: #542 (comment)
Fixes
Adaptive Column Width for
StaggeredLayout
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
PR Checklist
Please check if your PR fulfills the following requirements:
Other information