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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:46:17+00:00 2026-05-28T05:46:17+00:00

I am getting some data from an xml that updates every 2 minutes or

  • 0

I am getting some data from an xml that updates every 2 minutes or so with async WebRequest. So i need everytime the data changes the listbox to change accordingly. I pull the data from the internet and the last lines of code are these.

    IEnumerable<Update> list = from y in xelement.Descendants("Song")
                   select new Update()
                   {
                       NowTitle = y.Attribute("title").Value,
                       NowArtist = y.Element("Artist").Attribute("name").Value
                   };
                   Dispatcher.BeginInvoke(()=> nowList.ItemsSource = list);

XAML looks like this.

     <ListBox x:Name="nowList" Height="86" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,0,0,0" Orientation="Vertical" Background="Gray" HorizontalAlignment="Stretch">
                            <TextBlock Height="Auto" Width="480" Text="{Binding Path=NowTitle, Mode=OneWay}" TextWrapping="Wrap" TextAlignment="Center" FontSize="24" FontWeight="Bold" Foreground="#FFE5D623" HorizontalAlignment="Stretch" />
                            <TextBlock Height="Auto" Width="480" Text="{Binding Path=NowArtist, Mode=OneWay}" TextWrapping="Wrap" TextAlignment="Center" FontSize="24" FontWeight="Bold" Foreground="#FFE5D623" HorizontalAlignment="Stretch" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

the class Update that contains the properties is this.

    public class Update : INotifyPropertyChanged
{

    string nowTitle;
    string nowArtist;
    public string NowTitle
    {
        get
        {
            if (!string.IsNullOrEmpty(nowTitle))
            {
                return "Τώρα : " + nowTitle;
            }
            else
            {
                return "something";
            }
        }
        set { this.nowTitle = value;
        NotifyPropertyChanged("NowTitle");
        }
    }
    public string NowArtist
    {
        get
        {
            if (!string.IsNullOrEmpty(nowTitle))
            {
                return "by " + nowArtist;
            }
            else
            {
                return "";
            }
        }
        set { this.nowArtist = value;
        NotifyPropertyChanged("NowArtist");
        }
    }


    #region INotifyPropertyChanged Members
    public event PropertyChangedEventHandler PropertyChanged;
    public void NotifyPropertyChanged(String propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (null != handler)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    #endregion

}

Can anyone tell me what am i doing wrong? thanks!

  • 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-28T05:46:18+00:00Added an answer on May 28, 2026 at 5:46 am

    two things, first, make sure your nowList property is raising property changed events, second, make sure your nowList is of type ObservableCollection< Update >

    <edit>
    

    If nowList is your listbox, that is more then likely your culprite. try making an ObservableCollection<Update> as a property that raises change events, and then in your XAML bind your list box to that…

    <ListBox ItemSource={Binding myList}/>
    

    I am relatively sure that will fix your problem

    </edit>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a script that extracts some data from a complex Excel
I'm getting some data from the web service and saving it in the core
I am getting some junk data returned from a ToString() call on a DateTime
I Have activity that get some data from the internet, and shows it to
I have a table that contains some meta data in an XML field. For
I am working with some code that uses an OleDbConnection to load data from
I've just discovered (by necessity) that TSQL has some functionality to extract data from
In my application am getting an xml file from server and in that i
Currently i am having some problems with getting some data out of a DataTable
I'm having a little dilemma with an iphone project. I'm getting some JSON 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.