TreeView crashes when using TemplateSelector and loading certain amount of nodes #8791
Labels
area-TreeView
bug
Something isn't working
closed-Duplicate
Described behavior is already captured by another issue.
team-Controls
Issue for the Controls team
Describe the bug
When adding a TemplateSelector to a TreeView with several different templates, after loading the TreeView with an ItemsSource with a certain number of elements, the App will crash complaining of an exception when trying to cast the ViewModel bount to a node.
It seems like it is trying to reuse a node but if it was bound formerly to a specific viewmodel type, and later it is bound to another type, it still tries to cast the current viewmodel to the other one's type.
A sample App is supplied.
WinUITreeviewErrors.zip
Steps to reproduce the bug
Launch the sample application and it should crash.
Expected behavior
Being able to have an items source for a TreeView, with any amount of elements of several types that should be represented through a Template selector without crashing.
Screenshots
The exception shown after launching the sample Application:
NuGet package version
None
Windows version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: