You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Omsad
changed the title
Animation causing Text colour issue when recycling DataGridCell content.
Text colour issue when recycling DataGridCell content.
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
The text was updated successfully, but these errors were encountered: