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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:59:06+00:00 2026-05-23T19:59:06+00:00

I have a WPF MVVM prism application to upload files. I filled a datagrid

  • 0

I have a WPF MVVM prism application to upload files.
I filled a datagrid with a list of files from a directory and got an upload button to upload the selected files from the datagrid.

For this I pass the grid selecteditems to the command parameter of the button.
I successfully implemented this in the synchronous way and now want to extend
this functionality in asynchronous way by using delegates.

This is my asynchronous function call:

asyncUpload.BeginInvoke(selectedFiles, out tt, new AsyncCallback(test), null);

Here the selected files are the selecteditems from the datagrid passed through the command parameter of the upload button.
The problem is that while executing the first thread for uploading, I’m selecting another set of files from the datagrid to upload that will change the first thread’s selected files.

How can I solve this?

  • 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-23T19:59:07+00:00Added an answer on May 23, 2026 at 7:59 pm

    Don’t pass the actual SelectedItems list into your BeginInvoke() method.

    Instead, pass a copy of the SelectedItems list.

    Array[] array = new Array[dataGrid.SelectedItems.Count];
    
    dataGrid.SelectedItems.CopyTo(array, 0);
    
    asyncUpload.BeginInvoke(array.ToList(), out tt, new AsyncCallback(test), null); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which I am developing using WPF\Prism\MVVM. All is going well
I have a WPF application based on PRISM that utilizes the MVVM pattern. I
I've an WPF application where tried to implement MVVM pattern and Prism 2. I
I'm currently introducing Prism to a new Wpf application, and am using the MVVM
I am writing an WPF MVVM application using Prism. A couple days ago I
I'm working on my first true WPF MVVM pattern application. Currently I have a
I have a WPF application that mostly follows MVVM, which I am trying to
I have a WPF application which is built on the MVVM design pattern. I
Considering you have an MVVM Architecture in WPF like Josh Smith's examples How would
I have a WPF application in VS 2008 with some web service references. For

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.