Repository navigation
Description
Description
In .NET MAUI, when using a FlexLayout with Wrap="true" and placing Button controls within it, the layout does not consistently wrap elements as expected. Under certain conditionsβsuch as runtime property changes that subtly affect the button sizeβthe layout places buttons unevenly, stacking one on top of the other rather than continuing horizontally.
FrameworkIssue.mp4
A reproducible scenario involves modifying the FontFamily of buttons dynamically, which leads to subtle dimension shifts. These micro-adjustments disrupt the wrap logic, causing buttons to stack vertically in an unintended one-above-another fashion, despite sufficient horizontal space.
This issue highlights a sensitivity in FlexLayoutβs wrap calculation algorithm when handling controls that experience dynamic resizing during runtime.
Steps to Reproduce
- Create a new .NET MAUI app.
- In the MainPage.xaml, add a FlexLayout with Wrap="true" and horizontal.
- Add multiple Button controls inside the FlexLayout, and bind their FontFamily and Text to a toggleable state.
- Run the app and click the buttons repeatedly.
- Observe the layout: As font toggles and button sizes change subtly, the FlexLayout may stack buttons vertically instead of wrapping properlyβeven when horizontal space is available.
Link to public reproduction project repository
No response
Version with bug
10.0.0-preview.6
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
I was not able test on other platforms
Affected platform versions
Windows
Did you find any workaround?
No response
Activity
DavidIDCI commentedon Oct 6, 2025
I was able to reproduce this issue on an Android device by using the provided sample and selecting the center of the three buttons.
This is not a Windows-only issue.
30957-android.mp4
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
[Windows/Android] FlexLayout: Fix wrap misalignment due to floating-pβ¦
June 8th, Candidate (#35716)