TreeDataGrid TemplateColumn & ViewLocator issue #18000
-
When I double-click and edit the TemplateColumn cell of the TreeDataGrid, I get an error, and later through debugging, I find that it enters the ViewLocator, but the TextColumn does not enter the ViewLocator. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Your viewlocator is a DataTemplate, added somewhere upstream from your TreeDataGrid instance in the logical/view tree? Then possibly that TemplateColumn is searching for a datatemplate, cannot find what it wants and ends up in this viewlocator that passes its 'Match(object? data)'. |
Beta Was this translation helpful? Give feedback.
It's somewhat complicated. Basically Avalonia searches up the tree, all the way to the application level; until it finds a matching template. Generally the view locator is placed on the application level, so if there is no closer matching template the view locator gets used.
There is some docs here:
https://docs.avaloniaui.net/docs/get-started/wpf/datatemplates
https://docs.avaloniaui.net/docs/concepts/templates/data-templates-collection
https://docs.avaloniaui.net/docs/concepts/templates/reusing-data-templates