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

Call InvalidateMeasure on DockLayout when properties change affecting layout #1258

Merged
merged 6 commits into from
Jun 22, 2023
Merged

Call InvalidateMeasure on DockLayout when properties change affecting layout #1258

merged 6 commits into from
Jun 22, 2023

Conversation

BretJohnson
Copy link
Contributor

Description of Change

When properties are updated affecting layout, InvalidateMeasure should be called to trigger the layout to happen, normally called via a propertyChanged notification. This PR adds that for DockLayout. The InvalidateMeasure method added here is similar to what's called for Grid properties in the MAUI repo.

Linked Issues

PR Checklist

Additional information

Note that I attempted adding unit tests, but none of my attempts were able to catch the behavior difference when InvalidateMeasure is called. This may be something normally done by "device tests" in the MAUI repo. So I ended up just testing manually against my test repo, which all looked good.

@brminnick
Copy link
Collaborator

Thanks Bret!

Just curious - are there any severe performance impacts to this? In other words, should we wrap InvalidateMeasure in #if DEBUG so that it works in Hot Reload and avoids any potential performance problems?

@BretJohnson
Copy link
Contributor Author

Thanks Bret!

Just curious - are there any severe performance impacts to this? In other words, should we wrap InvalidateMeasure in #if DEBUG so that it works in Hot Reload and avoids any potential performance problems?

No, doing the InvalidateMeasure when updating properties that can affect layout is expected - all the built in MAUI controls do it. Note that it's not only needed for Hot Reload; it's also needed when those properties are updated (beyond what's in the original XAML) by C# code. So it's a potential app runtime problem too, not just a Hot Reload issue.

Copy link
Collaborator

@brminnick brminnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Bret!

@brminnick brminnick enabled auto-merge (squash) June 22, 2023 00:20
@brminnick brminnick merged commit 4ebfa8b into CommunityToolkit:main Jun 22, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] DockLayout doesn't update when DockPosition updated via Hot Reload / code behind
2 participants