开发者

How can I use an XPathNodeIterator with WPF DataGrid?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜