Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:24:44+00:00 2026-06-15T10:24:44+00:00

I have XML data similar to the example below and I am trying to

  • 0

I have XML data similar to the example below and I am trying to bind it to a ListView. I am having trouble binding the element name, which is the brand of the car in the example. I have found out from this post Xaml Support for Local Name in XPath that xaml doesn’t support xpath function names. Therefore, local-name() doesn’t work. But there got to be a way to do this…

<Window x:Class="WpfApplication4.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        Height="350"
        Width="525">
  <Window.Resources>
    <XmlDataProvider x:Key="DataSource">
      <x:XData>
        <Cars xmlns="">
          <Data>
            <Honda Year="2012"
                   Color="Red"
                   Model="Accord" />
            <Subuar Year="2008"
                    Color="Blue"
                    Model="Outback" />
            <Ford Year="2000"
                  Color="Black"
                  Model="Focus" />
          </Data>
        </Cars>
      </x:XData>
    </XmlDataProvider>
  </Window.Resources>
  <ListView ItemsSource="{Binding XPath=Cars/Data/*}"
            DataContext="{StaticResource DataSource}">
    <ListView.View>
      <GridView>
        <GridViewColumn DisplayMemberBinding="{Binding XPath=???}"
                        Header="Brand" />
        <GridViewColumn DisplayMemberBinding="{Binding XPath=@Year}"
                        Header="Year" />
        <GridViewColumn DisplayMemberBinding="{Binding XPath=@Color}"
                        Header="Color" />
        <GridViewColumn DisplayMemberBinding="{Binding XPath=@Model}"
                        Header="Model" />
      </GridView>
    </ListView.View>
  </ListView>
</Window>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:24:45+00:00Added an answer on June 15, 2026 at 10:24 am

    If you use the normal Binding.Path is should bind to the properties of the DataContext object which should be an XmlElement so just try {Binding Name}.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of System.Xml.XmlNode with data similar to this: [0] = <Node1
I have some xml similar to this: <?xml version=1.0 encoding=utf-8 ?> <data> <resources> <resource
I have an xml data file and I want to populate a listview in
I have a single xml document (data.xml), which I display as HTML using an
I have some simple data in XML format which I need to convert to
I have an XML with multiple nodes with similar data in each. I want
I have an XML file that will be similar to the structure below: <?xml
I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I
I have grabbed some XML data using this piece of jQuery: $.ajax({ type: POST,
If I have the xml/html data to post we need to encode the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.