Has anyone had issues with a Label refusing to resize? #23543
Unanswered
OwenFromAI
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Here's a puzzle that's been stumping me for days. I'm working on Android. You can't really get the same behavior on Windows for some technical reasons, and I haven't tested on iOS yet. This is my workload list:
I've not yet updated to latest-greatest because our team's still evaluating if there are issues with it and I"m not sure if I can have different MAUI versions side-by-side.
I've got a real simple layout to reproduce, I'm testing with something like this:
All that "UpdateTextCommand" does is:
In my application, I'm getting into a state where if the text becomes very long, the label DOES NOT resize. This only happens in one case. If I put a button on the page like the above reproduction, everything works.
But we have an authorization component that displays a browser. For some reason after that happens, this label refuses to resize UNLESS I make a page orientation change.
I went a step further to create a new class derived from
Label
. I added overrides forMeasureOverride
andArrangeOverride
to log what was happening. When the label is working, I see log messages that make sense:The text changed, measurement happens. This text is small, so it's only one line, and 19.5 pixels must be the height for that.
Here's what happens after I close the browser instead of authorizing:
The text changes. But no remeasure happens. It really should be happening. If I rework my code to let a button push change the text, not only do I see the results I want, the log verifies a remeasure is happening:
If I push that same button after the auth process, I get similar "no resize" results.
So I'm starting to dive into what the heck this authorization component actually does, but I'm stumped as to why my control decides to stop letting the text affect its size. I thought the problem was the
VerticalOptions
, but changing them has no effect. I thought maybe using aGrid
instead ofVerticalStackLayout
would help. It doesn't. I wish I could create an easy reproduction of THAT, but I'm still unraveling just what the heck that bit of code even does.Something about the process of the app suspending, a browser being displayed, then the app being resumed makes the label suspend the behavior that causes it to invalidate its layout when the text changes. Something about making an orientation change "fixes" the problem and causes me to get expected results.
Another fun quirk: if I rig up a button to call
InvalidateMeasure()
that doesn't work either. It's like something has cached the size of the Label and decided there's no need to update that cache.Has anyone else seen anything similar? I'm at the point where I'm about to replace this with a custom Label made using GraphicsView. But I'm a little worried that will just reveal there is some larger issue being caused by our authorization component.
Beta Was this translation helpful? Give feedback.
All reactions