如何展平 WPF TreeView
我需要一个行为类似于树视图的控件(绑定到树结构,根据绑定对象的 IsExpanded 属性展开子节点),但显示类似网格的数据(无缩进或切换图像)。
展开折叠将根据绑定对象自动发生。
TreeView 很完美,我只需要删除缩进和三角形图像,使其垂直平坦,就像网格列一样。
我想我可以尝试覆盖 TreeViewItem 模板,但这只是不显示任何内容..
I need a control that behaves like a treeview (binds to a tree structure, expands child nodes based on IsExpanded property of bound object), yet displays data like the grid (no indenting, or toggle images).
The expand collapse will be happening automatically based on bound object.
TreeView is perfect, i just need to remove the indentation and the triangle image to make it vertically flat, like a grid column.
I suppose i could try overriding the TreeViewItem template, but that just doesn't display anything..
基于MSDN上的
TreeView
样式,像这样的东西应该有效:Based on the
TreeView
style on MSDN, something like this should work: