As title, is it possible?
I have seen in TreeView you can defines different HierarchicalDataTemplate for different datatype using DataType attribute, it doens’t even need DataTemplateSelector.
So I wonder if is possible to choose a template according to a binded value without using DataTemplateSelector?
In my condition, is very simple, if the data object’s Property = 1, then display template1, 2 then template2.
Is it possible to do it without DataTemplateSelector?
Yes, you can use a
DataTriggerI actually prefer
DataTriggersto aDataTemplateSelectorbecause they respond toPropertyChangenotifications, and I prefer to see my UI logic in my UI code.