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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:29:20+00:00 2026-05-26T16:29:20+00:00

Im trying to load a XML into an object with LinQ in Silverlight with

  • 0

Im trying to load a XML into an object with LinQ in Silverlight with WPF, but i can’t fill or binding my combobox.

The code of the object is:

    public class Language_Index
{
    public string Prefix { get; set; }
    public string Status { get; set; }
    public string Name { get; set; }
}

My XML is:

<languages_index>
<item prefix="VBNET" name="Visual Basic .NET" status="enabled" />
<item prefix="CS" name="C#" status="disabled" />

and the Code to load and present data is:

            string XmlString = e.Result; // Got all your XML data in to a string 

        XDocument elem = XDocument.Load(XmlReader.Create(new StringReader(XmlString)));

        var feed_language_index = from nod in elem.Descendants("languages_index")
                                  select new Language_Index
                                  {
                                      Name = nod.Element("item").Attribute("name").Value,
                                      Status = nod.Element("item").Attribute("status").Value,
                                      Prefix = nod.Element("item").Attribute("prefix").Value

                                  };

        LanguageSelector.ItemsSource = feed_language_index;

Of course the pasted code has no errors, but doesnt work.
LanguageSelector its my combo. There is NO problem in the linq, the problem is when i binding the combobox 🙂

That i really want is try to do something like:
MyComboBox.DataSource = MyClass.name;
for every element.

thanks in advance! 🙂

  • 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-26T16:29:20+00:00Added an answer on May 26, 2026 at 4:29 pm

    I’d suggest you try converting your LINQ to a list and check your VS output window for binding errors.

        string XmlString = e.Result;
    
        XDocument elem = XDocument.Load(XmlReader.Create(new StringReader(XmlString)));
    
        var feedLanguages = 
                (from nod in elem.Descendants("languages_index")
                select new Language_Index
                {
                        Name = nod.Element("item").Attribute("name").Value,
                        Status = nod.Element("item").Attribute("status").Value,
                        Prefix = nod.Element("item").Attribute("prefix").Value
                }).ToList();
    
        LanguageSelector.ItemsSource = feedLanguages;
    

    Sorry for removing your underscores. 🙂

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

Sidebar

Related Questions

I'm trying to load a xml document into an object XPathDocument in C#. My
Trying to read into an object the following XML file (can be changed) into
I am trying to load multiple elements with the same name from XML into
I'm trying to call a function after I load some XML into Actionscript, and
I'm trying to load Gravatars into Flash. Luckily, they provided a crossdomain.xml file at
I'm trying to read a dataset as xml and load it into an XML
I'm trying to use the following code # LOAD XML FILE $XML = new
I am trying to load a very basic XML document but everytime I get
I have this code, but can't get it all working. I am trying to
I am trying to load data from XML string into a structure of some

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.