WPF HiercharchicalDataTemplate.DataType: How to react on interfaces?

后端 未结 3 453
有刺的猬
有刺的猬 2021-01-14 18:44

Problem

I\'ve got a collection of IThings and I\'d like to create a HierarchicalDataTemplate for a TreeView. The straightfor

3条回答
  •  难免孤独
    2021-01-14 19:26

    Another solution is you give a key to the HierarchicalDataTemplate and put it in the Windows.Resources, and manually reference to it in the TreeView.

    But that limits the autoselection of data template according to data type, which is provided by WPF TreeView.

提交回复
热议问题