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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:17:20+00:00 2026-05-21T23:17:20+00:00

Hey all, I’m writing a windows phone application in silverlight, and I’m trying to

  • 0

Hey all, I’m writing a windows phone application in silverlight, and I’m trying to dynamically update the source of a DataTemplate I have in place. Here’s the xaml that I have:

    <ListBox Grid.Row="1" Height="607" HorizontalAlignment="Left" Name="listBox1" VerticalAlignment="Top" Width="480">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" Height="132">
                    <StackPanel Width="370">
                        <TextBlock Text="{Binding Transcription}" Foreground="#FFC8AB14" FontSize="28" />
                        <TextBlock Text="{Binding Duration}" TextWrapping="Wrap" FontSize="24" />
                    </StackPanel>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

In the C# behind it, I pass the data along in the main init function like so:

        list.Add(new NoteToSelf { Transcription = "oh hi", Duration = "9001 seconds" });
        list.Add(new NoteToSelf { Transcription = "fgsfds", Duration = "$Texas seconds" });
        listBox1.ItemsSource = list;   

Where list is a List collection. All this works great – the hardcoded data is displayed as expected on screen. However, when I try to dynamically update the information, it silently fails. If I bind an action to a button that runs this code:

        list.Add(new NoteToSelf { Transcription = "FFUUUUUUUU", Duration = "LISTBOX, Y U NO UPDATE?" });
        listBox1.ItemsSource = list;

I would expect it to add a new element to the collection, reassign the source for the DataTemplate, then update the screen with the new data. This however is not the case. How would I go about doing this?

Obviously this is POC code that is simply a means to an end, I’m just looking to get elements to dynamically update at the moment. Also, I may very well be approaching this in the wrong way, if there is a better way to dynamically add elements on the screen from a template it would be immensely helpful to hear them.

Thanks all.

  • 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-21T23:17:21+00:00Added an answer on May 21, 2026 at 11:17 pm

    You didn’t state what type list was, but I’m going to assume its a plain List<>. In order to update the UI, it needs to have some sort of notification mechanism. The framework supports this through INotifyPropertyChanged. You can implement INotifyPropertyChanged on your databound class, and manually update as you add, or use a container that implements it. The easiest approach is to replace your List<> with an ObservableCollection<>.

        var list = new ObservableCollection<NoteToSelf>();
        list.Add(new NoteToSelf { Transcription = "oh hi", Duration = "9001 seconds" });
        list.Add(new NoteToSelf { Transcription = "fgsfds", Duration = "$Texas seconds" });
        listBox1.ItemsSource = list;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all i have a JSFiddle that i have been working on with trying
Hey all i have an XML file that i am trying to loop though.
Hey all. I'm trying to see about handling events in a console application. I
Hey all, I'm writing a C program, and I want to have an array
Hey all, I am writing a logviewer application. These logs are between 100-200 megs
hey all, i have a question about urlmapping in grails. I'm trying to make
Hey all trying to play with nodejs MVC using express and mongoose. I have
Hey all I'm trying to make a 3d game in with 2d sprite characters.
Hey all. I'm wondering how to implement a timeout event in the System.Windows.Forms.Webbrowser control?
Hey all. Here is the scenario. I have the below code, and I'm needing

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.