-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix FlexLayout Grow causes measured child sizes to be ignored #34535
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
Merged
kubaflo
merged 5 commits into
dotnet:inflight/current
from
devanathan-vaithiyanathan:fix-34464
Mar 22, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0f28511
fix added
devanathan-vaithiyanathan 2ebf4df
test added
devanathan-vaithiyanathan 372f4ca
unit test and co pilot changes added
devanathan-vaithiyanathan 67592bb
snapshot added
devanathan-vaithiyanathan b333f03
Merge branch 'inflight/current' into fix-34464
kubaflo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+49.9 KB
....Android.Tests/snapshots/android/FlexLayoutWithBindableLayoutDisplaysLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| using System.Collections.Generic; | ||
| using Microsoft.Maui; | ||
| using Microsoft.Maui.Controls; | ||
| using Microsoft.Maui.Graphics; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 34464, "FlexLayout with BindableLayout and Label text display", PlatformAffected.All)] | ||
| public class Issue34464 : ContentPage | ||
| { | ||
| public Issue34464() | ||
| { | ||
| var items = new List<string> | ||
| { | ||
| "Some Medium Text", | ||
| "Shorter Text", | ||
| "Slightly More Text", | ||
| "One - Two", | ||
| "Two - Four", | ||
| "Two - Three", | ||
| "One - Eleven", | ||
| }; | ||
|
|
||
| var flexLayout = new FlexLayout | ||
| { | ||
| Wrap = Microsoft.Maui.Layouts.FlexWrap.Wrap, | ||
| AutomationId = "TestFlexLayout" | ||
| }; | ||
|
|
||
| BindableLayout.SetItemsSource(flexLayout, items); | ||
| BindableLayout.SetItemTemplate(flexLayout, new DataTemplate(() => | ||
| { | ||
| var border = new Border | ||
| { | ||
| BackgroundColor = Color.FromArgb("#ffcccccc"), | ||
| Stroke = Color.FromArgb("#ffb8b8b8"), | ||
| Padding = new Thickness(12) | ||
| }; | ||
|
|
||
| FlexLayout.SetGrow(border, 1); | ||
| FlexLayout.SetShrink(border, 0); | ||
|
|
||
| var backgroundBorder = new Border | ||
| { | ||
| BackgroundColor = Color.FromArgb("#44ff0000") | ||
| }; | ||
|
|
||
| var label = new Label | ||
| { | ||
| LineBreakMode = LineBreakMode.NoWrap, | ||
| FontSize = 20, | ||
| HorizontalTextAlignment = TextAlignment.Center, | ||
| VerticalTextAlignment = TextAlignment.Center, | ||
| TextColor = Color.FromArgb("#ff000000") | ||
| }; | ||
|
|
||
| label.SetBinding(Label.TextProperty, "."); | ||
|
|
||
| var grid = new Grid | ||
| { | ||
| Children = { backgroundBorder, label } | ||
| }; | ||
|
|
||
| border.Content = grid; | ||
|
|
||
| return border; | ||
| })); | ||
|
|
||
| var headerLabel = new Label | ||
| { | ||
| Text = "FlexLayout with BindableLayout Items:", | ||
| FontSize = 16, | ||
| Margin = new Thickness(10), | ||
| AutomationId = "HeaderLabel" | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Children = { headerLabel, flexLayout } | ||
| }; | ||
| } | ||
| } |
Binary file added
BIN
+29.7 KB
...estCases.Mac.Tests/snapshots/mac/FlexLayoutWithBindableLayoutDisplaysLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions
20
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34464.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue34464 : _IssuesUITest | ||
| { | ||
| public Issue34464(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "FlexLayout with BindableLayout and Label text display"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Layout)] | ||
| public void FlexLayoutWithBindableLayoutDisplaysLabels() | ||
| { | ||
| App.WaitForElement("HeaderLabel"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
Binary file added
BIN
+16.8 KB
...es.WinUI.Tests/snapshots/windows/FlexLayoutWithBindableLayoutDisplaysLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+62 KB
...estCases.iOS.Tests/snapshots/ios/FlexLayoutWithBindableLayoutDisplaysLabels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.