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 flickers in TextBlock with TextTrimming enabled when changing DataContext and dynamically rearranging #14811

Open
BAndysc opened this issue Mar 4, 2024 · 1 comment

Comments

@BAndysc
Copy link
Contributor

BAndysc commented Mar 4, 2024

Describe the bug

TextBlock is not rendered correctly when changing its DataContext in panel ArrangeOverride.

To Reproduce

Steps to reproduce the behavior:

Unfortunately this bug didn't occur when I extracted the control to a separate project, it might be related to the hierarchy of the components in the real app (Dock control involved etc), but the app is open source, so you can reproduce it:

  1. Clone https://github.com/BAndysc/WoWDatabaseEditor
  2. Checkout branch avalonia11-bug
  3. Pull submodules: git submodule update --init --recursive
  4. Run LoaderAvalonia project
  5. In the left tool panel, switch to Tables panel and select "Avalonia 11 bug Demo" from the combo box
    image
  6. Shrink the panel so that the texts start to collapse
  7. Start scrolling. Note: it rarely happens when scrolling down, mostly when scrolling up.

Expected behavior

Text shouldn't flicker.

Info about the code:

The offending view is in file Avalonia11BugDemoView. The control that runs the tree is my custom VirtualizedTreeView, which virtualizes VirtualizedTreeViewItem by iterating through ItemsSource in ArrangeOverride and arranges only visible items and sets their DataContext. I don't think it is illegal?

Screenshots

11.1.999-cibuild0045529-beta:

Screen.Recording.2024-03-04.at.12.04.31.mov

I feel like this PR changed the flickering a bit #14806 But it still occurs
11.1.999-cibuild0045561-beta:

Screen.Recording.2024-03-04.at.12.01.07.mov

Note: when I expanded the panel so that the texts no longer collapse, there is no flickering

Environment

  • OS: macOS
  • Avalonia-Version: 11.1.999-cibuild0045561-beta, 11.1.999-cibuild0045529-beta

Additional context

Note: when I set TextTrimming to None, there is no flickering.

@BAndysc BAndysc added the bug label Mar 4, 2024
@maxkatz6
Copy link
Member

maxkatz6 commented Mar 5, 2024

It might be related to text layout invalidation as another similar issue before @Gillibald. It was fixed by #14705.

@Gillibald Gillibald self-assigned this Mar 5, 2024
@BAndysc BAndysc changed the title Text flickers in TextBlock with TextTrimming enabled when scrolling Text flickers in TextBlock with TextTrimming enabled when changing DataContext and dynamically rearranging Mar 5, 2024
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

3 participants