Skip to content

Fix Window.MeasureOverride measuring with the old ClientSize #18338

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
merged 1 commit into from
Feb 28, 2025

Conversation

MrJul
Copy link
Member

@MrJul MrJul commented Feb 27, 2025

What does the pull request do?

This PR fixes Window.MeasureOverride incorrectly measuring its child using its old ClientSize when the Width or Height of the window is manually set (and SizeToContent == Manual).

An existing unit test Child_Should_Be_Measured_With_Width_And_Height_If_SizeToContent_Is_Manual has been amended, making sure that the logic is still properly applied when Window.Width/Height changes.

What is the current behavior?

Setting Window.Width/Height triggers a measure pass with the old ClientSize instead of the new bounds. The child's measure call is ignored (since the measure bounds haven't changed). However, this still updates the Window's DesiredSize to the new bounds, causing an arrange pass to be triggered. Later, the window bounds effectively change, causing another layout pass, this time calling Measure with the proper values.

From the child's point of view, Arrange (from the first layout pass) is called before Measure (from the second layout pass).

What is the updated/expected behavior with this PR?

The child is properly measured with the new bounds, causing a single normal measure pass.

@MrJul MrJul added bug customer-priority Issue reported by a customer with a support agreement. backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Feb 27, 2025
@grokys grokys added this pull request to the merge queue Feb 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 28, 2025
@MrJul MrJul added this pull request to the merge queue Feb 28, 2025
Merged via the queue into AvaloniaUI:master with commit b815659 Feb 28, 2025
11 checks passed
@MrJul MrJul deleted the fix/window-measure branch February 28, 2025 10:01
@MrJul MrJul added backported-11.2.x and removed backport-candidate-11.2.x Consider this PR for backporting to 11.2 branch labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-11.2.x bug customer-priority Issue reported by a customer with a support agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants