-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Changing TextBlock.Text to multiline String causes rendering issue #3825
Comments
I can't access cibuilds prior to 6492, but I have 6151 and 6395 cached locally. The example provided works properly on 6151, but not 6395, so it was broken sometime in between those builds. |
@Gillibald for now you can repro from mat1jaczyyy/apollo-studio master, I had just reverted the cibuild I'm using to 6058 (where bug doesn't repro) but you should be able to get it just by upgrading Avalonia version. Steps:
I know this kind of repro might be too much to ask for, so I'll try to make a minimal repro later today... |
Latest build has the number 7054 |
@Gillibald I isolated the problem and turns out it's quite a specific setup. Hopefully this should get you a minimal repro of this |
Thanks. Will have a look. |
This is a bug with the Grid I think and not related to the TextBlock. This works:
|
Resizing the window immediately properly redraws and bug is gone |
I am also experiencing something very similar, but in a I am working around this right now by: MyProp = "";
MyProp = "real value"; |
When you add a TextBlock that is bound to Bounds.Height of the affected TextBlock does the height change? |
No, the height does not change. I can see that visually, too -- I have a really long string (directory) and just the last folder part should be changing. I did a test, and if the height changes, the MyProp += "a"; then spam-clicking my button. As soon as the height changed, the UI updated. (Sorry, no repro right now. Tried to pull this out to a repro sample and that "fixed" it for some reason...not sure why atm.) |
I have an idea what is happening. Will rework the invalidation a bit and hopefully it fixes your issue. |
I've been beating my head against this this afternoon with version |
As best I can tell, the issue is with the constructor of I think this can be solved by just changing the constructor to take into account the baseline origin and ascent, i.e. change
to
Adding a non-null background resolves the issue because the dirty rect includes its (correct) bounds. I'd be happy to put a PR together if it helps. |
I don't see how this can be true. The GlyphRun's bounds don't originate at the baseline |
@Gillibald This resolved the issue in my testing, which I traced back to the clipping rectangle being too small, and all |
The correct fix is to create the bounds with |
I agree that would make sense for handling the ascent. |
Can be changed to
|
If you want you can test that fix and submit a PR. |
Just thinking about my proposed fix and it turns out I was wrong. GlyphRun's bounds should not care about the baseline origin. You were on the right track. I think this might work: |
@Gillibald I think you are right that ascent should be handled by |
I've got a TextBlock with text like this:
From code-behind, if I set the Text to a multi-line string like this:
The TextBlock will only render the first line fully, while the second line will only visually contain the region that was previously occupied by the original text. Screenshot examples:
Opening DevTools and inspecting the TextBlock causes it to redraw properly, showing all three lines.
cibuild0006806
The text was updated successfully, but these errors were encountered: