WPF Treeview Using Catel 4

徘徊边缘 提交于 2019-12-11 08:12:24

问题


Can anyone guide me in using Catel 4 and a WPF TreeView control? I'm trying to create something like the VS solution explorer. I have created models and VMs for each level of the tree.

When I add a hierarchical data template (HDT) and use the VM types for the DataType parameters, I get a tree showing the top-level collection member types. That is, WPF couldn't match the ItemsSource collection types to my HDT. If I change the HDT to use the model types, the TreeView behaves properly, but now my VMs aren't being used.

Thanks.

-reilly.


回答1:


I don't think it's a good idea to make every element inside the tree a view model (performance wise). A treeview (like the solution explorer) should be a single view model with models that contain nested models. So your model will be a complete object graph representing the items in the tree.



来源:https://stackoverflow.com/questions/25606319/wpf-treeview-using-catel-4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!