title: How to update ListBoxItem property
body: <p>I want to update DownloadingSpeed Property which is binded to TextBox in a ListBoxItem. I am generating ListBoxItems in c#. Please guide me how do i update Binding Content of TextBoxes within a ListItemBox in C#.</p>
  
  <p>WPF LisBox Code</p>
  
  <pre><code> &lt;ListBox Width="Auto" 
                   Name="WebsiteList"
                   MouseUp="SelectedListItem"
                   SelectedIndex="0"
                   Grid.Column="1" 
                   Grid.Row="2" 
                   Grid.RowSpan="2"
                   Margin="0,0,0,0"&gt;
              &lt;ListBox.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                      &lt;Grid Width="920"&gt;
                      &lt;StackPanel Orientation="Vertical"&gt;
                              &lt;StackPanel Orientation="Horizontal"&gt;
                                  &lt;Grid Width="920"&gt;
                                  &lt;TextBlock FontWeight="Bold" FontSize="18" Width="Auto"&gt;
                                  &lt;Hyperlink NavigateUri="http://google.com" FontStyle="Italic"&gt;
                                      &lt;Label Content="{Binding WebsiteTitle}" /&gt;&lt;Label FontSize="10" Margin="0,0,0,3" Content="{Binding DirectorySize}" /&gt;
                                  &lt;/Hyperlink&gt;
                                  &lt;/TextBlock&gt;
  
                                  &lt;TextBlock Width="0" TextAlignment="right"&gt;
                                      &lt;TextBlock Visibility="Hidden" Text="{Binding DownloadID}"/&gt;
                                      &lt;TextBlock Visibility="Hidden" Text="{Binding DirectoryPath}"/&gt;
                                      &lt;TextBlock Visibility="Hidden" Text="{Binding CurrentTime}"/&gt;
                                      &lt;TextBlock Visibility="Hidden" Text="{Binding CurrentDate}"/&gt;
                                      &lt;TextBlock Visibility="Hidden" Text="{Binding GivenUrl}"/&gt;
                                  &lt;/TextBlock&gt;
                                  &lt;/Grid&gt;
  
                              &lt;/StackPanel&gt;
  
                          &lt;StackPanel Orientation="Horizontal"&gt;
                                  &lt;Grid Width="920"&gt;
                                      &lt;ProgressBar Name="progress1" Maximum="100" Minimum="0" Value="30" Background="#FFF" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=Width}" Height="10" /&gt;
                                  &lt;/Grid&gt;
                          &lt;/StackPanel&gt;
                          &lt;StackPanel Orientation="Horizontal"&gt;
                                  &lt;Grid Width="920"&gt;
                              &lt;TextBlock HorizontalAlignment="Left" Width="Auto"&gt;Status: &lt;TextBlock Text="{Binding Status}"/&gt;&lt;/TextBlock&gt;
                                      &lt;TextBlock Width="Auto" TextAlignment="right"&gt;
                                      &lt;TextBlock Text="Downloading Speed: "/&gt; 
                                      &lt;TextBlock Name="DownloadingSpeed" Text="{Binding DownloadingSpeed}"/&gt;
                              &lt;/TextBlock&gt;
                                  &lt;/Grid&gt;
                              &lt;/StackPanel&gt;
                      &lt;/StackPanel&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ListBox.ItemTemplate&gt;
           &lt;/ListBox&gt; 
  </code></pre>
  
  <p>In MainWindow.xaml.cs</p>
  
  <pre><code> private void GenerateList()
  {
   List&lt;Download&gt; WebsitesList = new List&lt;Download&gt;();
  
   WebsitesList.Add(new Download() {DownloadID = ID, WebsiteTitle = WebTitle, Status = WebStatus, CurrentTime = CurrentTime,CurrentDate = CurrentDate, DownloadingSpeed = DownloadSpeed, DirectoryPath = path, DirectorySize = helper.GetDirectorySize(path),GivenUrl = url });
  
   WebsiteList.ItemsSource = WebsitesList;       
  }
  //get download speed and update DownloadingSpeed    
   private void updateDownloadingSpeed(object sender, EventArgs e)
      {
  
          interfaceStats = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics();
  
          downloadspeed = (interfaceStats.BytesReceived - previousbytesreceived) / 1024;
  
          previousbytesreceived = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics().BytesReceived;
  
          Download.DownloadingSpeed = Math.Round(downloadspeed, 2) + " KB/s"; //Rounding to 2 decimal places and save in DownloadSpeed Property
  }
  </code></pre>
  
  <p>In Download.cs</p>
  
  <pre><code> public class Download : INotifyPropertyChanged
      {
            private string _DownloadingSpeed = "0 kb/s";
          public string DownloadingSpeed
          {
              get { return _DownloadingSpeed; }
              set
              {
                  if (_DownloadingSpeed == value)
                      return;
  
                  _DownloadingSpeed = value;
                  this.OnPropertyChanged("DownloadingSpeed");
              }
          }
  
  
          public event PropertyChangedEventHandler PropertyChanged;
  
          protected void OnPropertyChanged(string propertyName)
          {
              if (this.PropertyChanged != null)
                  this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
          }
  
  }
  </code></pre>