dotnet / dotnet/maui

Measured size not set for arrange

Open
#4,019 12 comments 1 reaction 0 assignees View on GitHub
area-layout platform/android platform/ios platform/macos platform/windows s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

### Description

I have checked .Net MAUI measure method and returned required size for allocation. But the returned value not set for arrange method.

I have returned 100 for height allocation, but in arrange bounds not set with 100.

```
public class Button1 : Button
{
protected override Size MeasureOverride(double widthConstraint, double heightConstraint)
{
return new Size(widthConstraint, 100);
}
public override SizeRequest Measure(double widthConstraint, double heightConstraint, MeasureFlags flags = MeasureFlags.None)
{
return new Size(widthConstraint, 100);
}
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
{
return new Size(widthConstraint, 100);
}

protected override Size ArrangeOverride(Rectangle bounds)
{
return base.ArrangeOverride(bounds);
}

}
```

### Steps to Reproduce

[MauiApp2.zip](https://github.com/dotnet/maui/files/7838697/MauiApp2.zip)

1. Run the sample
2. Check the ArrangeOverride method parameter bounds value,
3. Bounds height value not match with measured size return height value.

### Version with bug

Preview 11

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, Android, Windows, macOS

### Affected platform versions

net6.0-windows10.0.19041

### Did you find any workaround?

No

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the MauiApp2.zip reproduction and run it on an affected platform. Inspect the custom Button1 MeasureOverride, OnMeasure, Measure, and ArrangeOverride methods, then compare the returned measured height with the bounds passed to ArrangeOverride; done means the arrange bounds reflect the expected measured size across the reported platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.