title: How can I remove an item from a list?
body: <p>I'm new on mvvm:
  Normal ways:</p>
  
  <pre><code>double progress;
      private DownloadOperation _activeDownload;
      private async void ProgressCallback(DownloadOperation obj)
      {
          try
          {
              progress
              = ((double)obj.Progress.BytesReceived / obj.Progress.TotalBytesToReceive);
              processDownload.Value = progress * 100;
              double _bytesToMBreceived = (double)(obj.Progress.BytesReceived / 1024) / 1024;
              double _bytesToMBtotal = (double)(obj.Progress.TotalBytesToReceive / 1024) / 1024;
              buffering.Text = "Downloading..." + string.Format("{0:0.00}", _bytesToMBreceived) + "MB /" + string.Format("{0:0.00}", _bytesToMBtotal) + "MB";
              if (progress &gt;= 1.0)
              {
                  _activeDownload = null;
                  processDownload.Value = 0;
                  buffering.Text = "Completed...";
                  await Task.Delay(500);
                  gridDownload.Visibility = Visibility.Collapsed;
  
                  var dialog = new MessageDialog("Download has completed");
                  await dialog.ShowAsync();
              }
          }
          catch (Exception)
          {
              return;
          }
  
      }
      private async Task StartDownloadAsync(DownloadOperation downloadoperation)
      {
  
          gridDownload.Visibility = Visibility.Visible;
          _activeDownload = downloadoperation;
          buffering.Text = "Waiting for a minute...";
          processDownload.Visibility = Visibility.Visible;
          var process = new Progress&lt;DownloadOperation&gt;(ProgressCallback);
          await downloadoperation.StartAsync().AsTask(process);
      }
      private async void downloadSongs(string requestUrl, string filename)
      {
          try
          {
              if (filename == null)
                  throw new ArgumentNullException("filename");
              //
              var downloader = new BackgroundDownloader();
              //StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename + ".mp3", CreationCollisionOption.ReplaceExisting);
              var regex = new Regex(@"[\\|/\:\*\?""&lt;&gt;\\|]");
              var result_filename = regex.Replace(filename, " ").Replace(";", "");
  
  
              FolderPicker fo = new FolderPicker();
              fo.SuggestedStartLocation = PickerLocationId.Downloads;
              fo.FileTypeFilter.Add(".mp3");
              StorageFolder folder = await fo.PickSingleFolderAsync();
              var filePart = await folder.CreateFileAsync(result_filename + ".mp3", CreationCollisionOption.GenerateUniqueName);
              DownloadOperation download = downloader.CreateDownload(new Uri(requestUrl), filePart);
              await StartDownloadAsync(download);
          }
  
          catch (Exception)
          {
              return;
          }
      }
  
      private async void btnDownload_Tapped(object sender, TappedRoutedEventArgs e)
      {
          try
          {
              if (buffering.Text == "Waiting for a minute..." &amp;&amp; processDownload.Value == 0 || processDownload.Value != 0)
              {
                  throw new Exception("You must waiting for downloading completed to download again");
              }
              else
                  downloadSongs(_linkdownload, _linktitle);
          }
  
          catch (Exception ex)
          {
              var Dialog = new MessageDialog(ex.Message);
              await Dialog.ShowAsync();
          }
      }
  </code></pre>
  
  <p>I want to switch this code to mvvm ways(not light mvvm...).
  ex:</p>
  
  <p>I have 3 items.</p>
  
  <ol>
  <li>item1 downloading 30%->31%->32%(by processbar)</li>
  <li>item2 waiting 0%</li>
  <li>item3 waiting 0%</li>
  </ol>
  
  <p>after item1 was finished and removed it then item2 will be downloading....</p>
  
  <pre><code>&lt;listbox.....&gt;
     &lt;listbox.Itemtemplate&gt;
        &lt;textblock text={binding title}
        &lt;textblock text{binding status}
        &lt;processbar value={binding process}
  ........
  </code></pre>
  
  <p>MVVM ways:</p>
  
  <pre><code>public class DownloadCommand
  {
      public string name { get; set; }
      public string status { get; set; }
      public int value { get; set; }
      public ICommand _downloadCommand { get; set; }
  
      public DownloadCommand()
      {
          _downloadCommand = new DownloadButtonClick();
      }
  
  
  
  
      public void ProgressCallBack(DownloadOperation obj)
      {
          double progress = ((double)obj.Progress.BytesReceived / obj.Progress.TotalBytesToReceive);
          double _bytesReceived = (double)(obj.Progress.BytesReceived / 1240);
          double _bytesTotal = (double)(obj.Progress.TotalBytesToReceive / 1240);
          if (progress != 1.0)
          {
              //listbox will removed this item and keep to download at next item.
          }
      }
  
      private async Task StartDownloadAsync(DownloadOperation obj)
      {
          var process = new Progress&lt;DownloadOperation&gt;(ProgressCallBack);
          await obj.StartAsync().AsTask(process);
      }
  
      private async void Download(string requestUrl, string filename, string fileType)
      {
          var downloader = new BackgroundDownloader();
          var regex = new Regex(@"[\\|/\:\*\?""&lt;&gt;\\|]");
          var result_filename = regex.Replace(filename, " ").Replace(";", "");
  
          FolderPicker fo = new FolderPicker();
          fo.SuggestedStartLocation = PickerLocationId.Downloads;
          fo.FileTypeFilter.Add(fileType);
          StorageFolder folder = await fo.PickSingleFolderAsync();
          var filePart = await folder.CreateFileAsync(result_filename + fileType, CreationCollisionOption.ReplaceExisting);
          DownloadOperation download = downloader.CreateDownload(new Uri(requestUrl), filePart);
          await StartDownloadAsync(download);
      }
  
      public class DownloadButtonClick : ICommand
      {
          public event EventHandler CanExecuteChanged;
  
          public bool CanExecute(object parameter)
          {
              return true;
          }
  
          public void Execute(object parameter)
          {
              //throw new NotImplementedException();
          }
      }
  </code></pre>
  
  <p><strong>I don't know to write whatever in here.</strong></p>
  
  <pre><code>    public void Execute(object parameter)
              {
                  //throw new NotImplementedException();
              }
  
  if (progress != 1.0)
              {
                  //listbox will removed this item and keep to download at next item.
              }
  </code></pre>