我有一些xml:
<Test>
<thing location="home" status="good"/>
<thing location="work" status="bad"/>
<thing location="mountains" status="good"/>
</Test>
上的叶子TreeView
是状态属性的值;节点将是位置属性的值。
├──坏
│.....└──
工作└──好
.......├──家
.......└──山
目前,我手动填充TreeView
(或TabControl
),遍历 xml,将节点添加到适当的叶子。
这可以通过数据绑定来完成吗?我猜会涉及转换器...
感谢您的任何建议。