Skip to content

Conversation

danwalmsley
Copy link
Member

If the user places the TDG inside a tab control and does the following:

  1. add 5 items.
  2. switch tabs to show and realize the 5 elements.
  3. switch tabs to detach from the visual tree.
  4. add 5 items (in non sequential order… inserts etc)
  5. switch tabs back.

the user will see many rows that are duplicated… i.e. the recycling mechanism messed up and assigned the same model to multiple rows.

This PR fixes the issue by recycling all elements when a TdgPresenter is detached from the VisualTree.

(the same logic is already implemented from detaching from the logical tree, and in recent memory leak fixes we unsubscribe from item changes during the detached phase, meaning we now need to handle this on visual tree detach also)

Copy link
Member

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

grokys added 3 commits August 28, 2025 20:19
Message from nuke was:

```
[WRN] : Solution /home/vsts/work/1/s/Avalonia.Controls.TreeDataGrid.sln has active build configurations for the build project.
Either enable SuppressBuildProjectCheck on Build.Solution or remove the following entries from the solution file:
  - {D45C7B46-A12C-4412-8397-B51B75A09999}.Debug|Any CPU.Build.0 = Debug|Any CPU
  - {D45C7B46-A12C-4412-8397-B51B75A09999}.Release|Any CPU.Build.0 = Release|Any CPU
```

Not sure why this has started happening now, but doing what it says.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants