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

Text colour issue when recycling DataGridCell content. #18214

Open
Omsad opened this issue Feb 16, 2025 · 0 comments
Open

Text colour issue when recycling DataGridCell content. #18214

Omsad opened this issue Feb 16, 2025 · 0 comments

Comments

@Omsad
Copy link

Omsad commented Feb 16, 2025

Describe the bug

I have an issue where when scrolling a data grid the text colour of the cells content is shown as black rather than white. You can see an example of it in the video below, e.g. the second column of Item 23 is rendered as black.

Problem.mp4

I think this is happening because when using an InlinesTextSource, the text runs are cached if the size of the text isn't changed. So they are created in MeasureOverride, at which point the Run isn't attached to the inline host. Once it's attached the size isn't different, so even if the text source is re-created they aren't, so the foreground colour isn't updated.

To Reproduce

Make sure your using a dark style on Windows, so that you can see the incorrect font colour.
Run the testing project.
Scroll down and then up, when the DataGridCell is recycled it can be rendered incorrectly.

Attached is an example projected used to generate the mp4 above.

DataGrid.zip

Expected behavior

The text is always rendered in the expected style.

Avalonia version

11.2.4

OS

Windows

Additional context

No response

@Omsad Omsad added the bug label Feb 16, 2025
@Omsad Omsad changed the title Animation causing Text colour issue when recycling DataGridCell content. Text colour issue when recycling DataGridCell content. Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants