Open prok155 opened 1 year ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on any platform with sample project. OnMeasureBug-master.zip
I found workaround. There are 2 methods:
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
protected override Size MeasureOverride(double widthConstraint, double heightConstraint)
When I override MeasureOverride
and call InvalidateMeasure()
from my content page, overrided method MeasureOverride
fires correctly.
In Xamarin.Forms there is only one method OnMeasure
, in MAUI there is additional method MeasureOverride
. Could you explain the difference between OnMeasure
and MeasureOverride
? It seems that these methods work almost the same..
This bug is not fixed yet, because MeasureOverride
should fire without calling InvalidateMeasure()
all the time, but I think that this workaround will help you to fix this issue.
Description
When I override method
SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
in my custom control it is not getting fired on all platforms. I'm unable to migrate my project from Xamarin to MAUI and I think that some custom controls may not work because of that bug.Steps to Reproduce
Create MAUI project.
Create following custom control:
You can debug and see that code inside
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
method never fires.Link to public reproduction project repository
https://github.com/prok155/OnMeasureBug
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
iOS,Android,Windows,macOS
Did you find any workaround?
Method
OnMeasure(double widthConstraint, double heightConstraint)
fires in my Xamarin.Forms project, so I think we should wait with migration to MAUI until it will be fixed.Relevant log output
No response