且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何绑定XML属性为树视图节点,而数据绑定的XDocument到WPF树视图

更新时间:2021-11-03 03:18:10

好哇!我想出如何绑定XAttribute。它不是直观,它不容易想象。但这里是如何可以做到

Hurrah !!! I figured out how to bind XAttribute. It is not intuitive and it's not easily imaginable. But here is how it can be done.

<TreeViewItem Header="{Binding Path=Attribute[Title].Value}"/>



这是很难想象标题可以直接在方括号中使用。

It is hard to imagine that Title can directly be used in square braces.

更多@此MSDN链接