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

  • Home
  • SEARCH
  • 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 9192753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:00:06+00:00 2026-06-17T21:00:06+00:00

I want to load data from XML file which is in IsolatedStorage. Then I

  • 0

I want to load data from XML file which is in IsolatedStorage. Then I have in variable specific index number which is XML element index. And here I have a problem, because I want to load in TextBoxes (in normal StackPanel) values from this element. I tried with binding and putting this in listbox but then I cannot read text from this boxes, cause it’s listbox items. Simply I want to load element attributes to TextBoxes and after it I want to read edited text in this textboxes.
This is example xml element:

<person index="1" att1="qwerty" att2="azerty" att3="abcdef"/>

This is Xaml code:

<StackPanel x:Name="stack">
 <TextBlock Height="27" Margin="0,0,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Record index:" VerticalAlignment="Top" Foreground="#FF6C6C6C"/>
 <TextBox Text="{Binding Index}" x:Name="index_box_det" Height="65" Margin="-12,-10,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FF40AA2F" HorizontalAlignment="Left" Width="467" SelectionBackground="#FF40AA2F" SelectionForeground="White" BorderBrush="#FF3FA92E" FontSize="18.667"/>
</StackPanel>

I have tried this:

var ind = "1";
        using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("People2.xml", FileMode.Open, isoStore))
            {
                XDocument loadedCustomData = XDocument.Load(isoStream);
                var filteredData = from c in loadedCustomData.Descendants("person")
                                   where c.Attribute("index").Value == ind
                                   select new Person()
                                   {
                                       index= c.Attribute("index").Value,
                                       att1= c.Attribute("att1").Value,
                                       att2= c.Attribute("att2").Value,
                                       att3= c.Attribute("att3").Value
                                   };
                stack.DataContext = filteredData;
            }

But as you think, it does not work. Somebody have idea to load this values to textboxes ?

EDIT:
I have tried this:

 var ind = "1";
        using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("People2.xml", FileMode.Open, isoStore))
            {
                XDocument loadedCustomData = XDocument.Load(isoStream);
                var filteredData = from c in loadedCustomData.Descendants("person")
                                   where c.Attribute("index").Value == ind
                                   select new Person()
                                   {
                                       index= c.Attribute("index").Value,
                                       att1= c.Attribute("att1").Value,
                                       att2= c.Attribute("att2").Value,
                                       att3= c.Attribute("att3").Value
                                   };
                stack.DataContext = filteredData;
            }

index_box_det.Text = Index;

Still not works.

  • 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-17T21:00:08+00:00Added an answer on June 17, 2026 at 9:00 pm

    You must invoke FirstOrDefault method:

    var ind = "1";
    using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
    {
        using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("People2.xml", FileMode.Open, isoStore))
        {
            XDocument loadedCustomData = XDocument.Load(isoStream);
            var filteredData = (from c in loadedCustomData.Descendants("person")
               where c.Attribute("index").Value == ind
               select new Person()
               {
                   Index = c.Attribute("index").Value,
                   Att1 = c.Attribute("att1").Value,
                   Att2 = c.Attribute("att2").Value,
                   Att3 = c.Attribute("att3").Value
               }).FirstOrDefault();
            stack.DataContext = filteredData;
        }
    }
    

    Person class:

    public class Person
    {
        string index;
        string att1;
        string att2;
        string att3;
    
        public string Index
        {
            get { return index; }
            set { index = value; }
        }
    
        public string Att1
        {
            get { return att1; }
            set { att1 = value; }
        }
    
        public string Att2
        {
            get { return att2; }
            set { att2 = value; }
        }
    
        public string Att3
        {
            get { return att3; }
            set { att3 = value; }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load data from an XML file and assign that data to
I have a form with a DataGridView and I want to load data from
I want to save data from a xml file to my database, and below
HI i have a peice of code which takes information from a xml file
i have xml file which contains some details i want to pick some value
I have a listbox to which I parse info from an XML file. I
I want to add one xml file (which has some static data related to
I have a magazine application i want that it load file from server and
I want to load data from MySql database to a HTTP form When I
I want to load my data on scroll down for my tableView. I have

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.