Skip to content
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

Handle setting of DesiredSize in Measure implementations, rather than MeasureOverride #19794

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Jan 9, 2024

Description of Change

At the moment, anyone creating a custom control is responsible for explicitly setting the value of DesiredSize during the measure step. This is confusing for implementers - it's not obvious that this is required. And honestly, it's only required because we didn't handle it in the IView.Measure() implementations, which would make a lot more sense than forcing everyone to handle it themselves.

These changes set the DesiredSize value to whatever gets returned from MeasureOverride() (which is what all the implementations were already doing).

Issues Fixed

Doesn't fix #7613 exactly, because the issue reported there isn't really a bug. But it does make the creation of custom controls based on ContentView much more intuitive.

@hartez hartez requested a review from a team as a code owner January 9, 2024 19:35
@hartez hartez requested review from mattleibow and rmarinho January 9, 2024 19:35
@rmarinho rmarinho enabled auto-merge (squash) January 10, 2024 12:32
@rmarinho
Copy link
Member

Do we need docs about this detail , like saying after version X you won't need to set DesiredSize ?

@hartez
Copy link
Contributor Author

hartez commented Jan 10, 2024

Do we need docs about this detail , like saying after version X you won't need to set DesiredSize ?

I don't think the docs currently say that you do need to set DesiredSize, so after this change they'll be accurate :)

@rmarinho rmarinho merged commit 3f99858 into main Jan 10, 2024
47 checks passed
@rmarinho rmarinho deleted the handle-desiredsize branch January 10, 2024 18:18
@samhouts samhouts added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Jan 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-8.0.7 fixed-in-9.0.100-preview.1.9973
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants