Image Measure Returns (0,0) in AutoFit Layout on Windows – Is This a Known Issue? #32677
Unanswered
MuthukumarMadasamy
asked this question in
Q&A
Replies: 1 comment
-
|
I don't know if this is relevant, but in VerticalStackLayoutManager.cs, the child-filtering guard differs from the one in your code. // From VerticalStackLayoutManager.cs
if (child.Visibility == Visibility.Collapsed)
{
continue;
}// AutoFitStackLayout
if (child.Visibility != Visibility.Visible)
continue; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm encountering a platform-specific issue in .NET MAUI related to image measurement inside a custom auto-sized layout. I’ve created a custom layout called AutoFitStackLayout that uses a layout manager to measure and arrange children vertically. Here's a simplified version of the layout code:
// AutoFitStackLayout.cs
using Microsoft.Maui.Layouts;
using System;
namespace AutoFitLayoutSample
{
public enum HeightMode
{
AutoFit,
Constrained
}
}
Issue:
When I use only an Image inside this layout, the measure call consistently returns (0,0) only on Windows. On other platforms like Android and iOS, the image eventually measures correctly after a few calls.
Workaround I find:
InvalidatedMeasure after Loaded the Layout.
Questions:
Any insights or suggestions would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions