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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:02:52+00:00 2026-05-25T16:02:52+00:00

Over the forum and on MSDN they have given a clear way to access

  • 0

Over the forum and on MSDN they have given a clear way to access the UI controls from different thread using Dispatcher.Invoke. But, when in UI thread, how do I access a WPF component ex DataGrid created on a different thread ?

In my situation, I start a thread to handle a long process. In this thread I create a DataTable, and bind it to a DataGrid which is also created in this thread.

Now, when it is time to display the DataGrid, I appropriately call the Dispatcher.Invoke on a UI control. But, when I try to access the DataGrid in my UI thread, I get an exception -The calling thread cannot access this object because a different thread owns it.

Any suggestion please ..

public void AddResultsController(ResultsController controller)
{
  NewResultsControllerDisplayDelegate newControllerDisplayDelegate = new NewResultsControllerDisplayDelegate(NewResultsControllerDisplay);
  this.docManager.Dispatcher.BeginInvoke(newControllerDisplayDelegate, System.Windows.Threading.DispatcherPriority.Normal, controller);
}

delegate void NewResultsControllerDisplayDelegate(ResultsController controller);
private void NewResultsControllerDisplay(ResultsController controller)
{
   Grid grd = new Grid();
   grd.Children.Add(controller.SummaryDataGrid);   // Exception is thrown here
}

In my background thread I call…

m_mainWindow.AddResultsController(m_controller);
  • 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-25T16:02:52+00:00Added an answer on May 25, 2026 at 4:02 pm

    You simply do not create UI-elements on background threads. Make your life easier and follow that rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have followed the tutorials over at MSDN and they all (from what I've
I have gone over a silly amount of forum posts and questions here. while
From my topic over @ jquery: https://forum.jquery.com/topic/multiple-pagebeforecreate-events-triggered-when-jqm-builds-the-page-for-nested-listviews-w-jsfiddle It's understandable now, but a little unintuitive.
A form I don't have any control over is POSTing data to my PHP
I have a Windows form application that's consuming web services over https and is
I have a unique situation over here. I have a button on a form
I am in way over my head, and am hoping anyone here can help.
thanks for all your advice I took out of this forum over the last
Continuing on from this question here: Forum data in mysql database What would be
I have one page that generates png images on the fly,project is not over

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.