开发者

How can I use an XPathNodeIterator with WPF DataGrid?

开发者 https://www.devze.com 2023-02-02 17:43 出处:网络
How can I use an开发者_JAVA技巧 XPathNodeIterator with a WPF DataGrid? Here\'s what I\'d like to do:

How can I use an开发者_JAVA技巧 XPathNodeIterator with a WPF DataGrid? Here's what I'd like to do:

        Dim xpd As New Xml.XPath.XPathDocument("filename.txt")
        Dim xpn As Xml.XPath.XPathNavigator = xpd.CreateNavigator
        DataGrid1.DataContext = xpn.Select("/node1/node2")


Which data grid are you using? Most likely, you want to assign DataGrid1.ItemsSource = xpn.Select("/node1/node2"). To be clear, this will bind the grid to whatever objects are in the xpn.Select result's IEnumerable. If that is enough, great. Otherwise, you might want to consider projecting the result of xpn.Select(...) into objects that make sense via LINQ.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号