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 6899671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:27:03+00:00 2026-05-27T07:27:03+00:00

Scenario: Grid view gets populated in WPF window. Having a static list in code

  • 0

Scenario:

  1. Grid view gets populated in WPF window.
  2. Having a static list in code behind.(which i want to get from a xml file).

Trying to move the static list into an xml file.For that i created a ml file in the following format

<customers>
<customer Name="abc"/>
<customer Name="def"/>
</customers>

CodeBehind:

Xdocument doc=Xdocument.load("customers.xml");
var customerList = (from e in doc.Descendants("Cusomters")

                            select new
                            {
                                CustomerName = e.Attribute("Name").Value
                            }).ToList();

I am unable to get the customer names from the xml file to the customerList.I would appreciate if someone can help me to move forward.

  • 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-05-27T07:27:04+00:00Added an answer on May 27, 2026 at 7:27 am

    "Cusomters" is spelled incorrectly, should be "Customers".

    Obviously this is not the code your are using since it doesn’t even compile. It should be this:

    XDocument doc = XDocument.Load( "customers.xml" );
    var customerList = (from e in doc.Descendants( "customer" )
            select new
            {
                CustomerName = e.Attribute( "Name" ).Value
            }).ToList();
    

    You really should mention the fact that it won’t compile. That, or you copied it in by hand incorrectly, which doesn’t help us help you either.

    The logical problem here is that you are asking for all Customers tags, note the s at the end. You really want to look for Customer tags, which have a name attribute. Customer*s* is simply the top level group.

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

Sidebar

Related Questions

I want to get the value of a hidden field in a grid view
Consider a web page having grid-view connected to SqlDataSource having all permission to insert
I am having trouble handling the selections in DataGridView . My grid view contains
Here's the scenario I have a Grid with some TextBlock controls, each in a
Scenario: A stored procedure receives from code a DateTime with, let's say DateTime.Now value,
Hey all, I've got a scenario where I want to switch the visiblity of
How to change the value of a text block inside a grid view in
I'm having a little bit of trouble sorting out the paging scenario with a
My scenario is that In MVC my page(view) has both user control(partial view) and
I have a list view that is displaying data using the gridview. This list

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.