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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:39:15+00:00 2026-06-12T18:39:15+00:00

the problem is simple I have GUI c#/xaml app and I want to run

  • 0

the problem is simple I have GUI c#/xaml app and I want to run GUI in one thread and some method ( infinite loop ) in another thread.
And I need to modify element in GUI ( listbox ) from second thread.
I tried create global variable and some other tips from web, but nothing run well.

now I have something like:

public delegate void InvokeDelegate(listdata Mujlist);
//in global scope
// and in Window class
public void UpdateList(listdata Mujlist)
{
    mujlistbox.DataContext = Mujlist;
}
// and in the second thread this
object[] obj = new object[1];
obj[0] = Mujlist;
mujlistbox.BeginInvoke(new InvokeDelegate(UpdateList), obj);

this maybe do a job well, BUT I can’t try this, because VS 2010 find error

Error 1 'System.Windows.Controls.ListBox' does not contain a definition for 'BeginInvoke' and no extension method 'BeginInvoke' accepting a first argument of type 'System.Windows.Controls.ListBox' could be found (are you missing a using directive or an assembly reference?)   D:\..\MainWindows.xaml.cs 85 28 WPFChat

BUT System.Windows.Forms have this method, so I am confused with this.

So, question is How can I simply update a listbox in “GUI thread” from child thread?

Where do I mistakes? Is there better way how do this? How?

  • 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-06-12T18:39:17+00:00Added an answer on June 12, 2026 at 6:39 pm

    With WPF, you need to use the Dispatcher.BeginInvoke method.

    While ListBox is a UIElement, which doesn’t contain a BeginInvoke method, it does derive from DispatcherObject. As such, it has a Dispatcher property you can use to get access to the Dispatcher:

    mujlistbox.Dispatcher.BeginInvoke(new InvokeDelegate(UpdateList), obj);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to resolve problem which in simple way could be like: GUI app
I have simple WinForms GUI that I want to use with TabPages. The problem
My problem is simple: I have a long list of elements that I want
I have a simple problem that I've been stuck on for some time and
I have simple problem as I am not much familiar with Java GUI. I
I have a simple java gui calculator, with 3 number systems (there are some
I have a very simple crawler. I want to make my current code run
I have simple PyGTK app. Since I have to run multiple periodic tasks to
i have rather very basic question. I have one GUI class and another which
I'm designing a simple GUI. I have Widgets, which have children and one parent.

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.