You can use XPath if you’re binding the XML document in the XAML, but what if you’re loading the XML document dynamically in the code behind? Is there any XPath methods available in the C# code behind?
(using .NET 3.5 SP1)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Load the XML into a XPathDocument in your code behind, and use an XPathNavigator to hold your query. The result of the XPathNavigator.Select() is an iterator that returns the selected nodes.
Example (using System.XML and System.Xml.XPath):