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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:28:06+00:00 2026-06-02T19:28:06+00:00

In my main window ( Thread A ), I start a new thread (

  • 0

In my main window (Thread A), I start a new thread (Thread B) which does some work while the user waits.

Thread B fires events if there is an error or extra information is required from the user, Thread A will listen to these events.

In Thread A’s event listener I need to show dialog messages to the user, I have a custom dialog window and show it using dialogWindow.showDialog(). This works fine, but causes an error when I try and set the owner of the dialog, I do this dialogWindow.Owner = Window.GetWindow(this).

The error that I get is: The calling thread cannot access this object because a different thread owns it.

What is the correct way to listen for events that are fired from a different thread?

  • 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-02T19:28:07+00:00Added an answer on June 2, 2026 at 7:28 pm

    The correct way to raise an event to the UI thread from the background thread is that, the event should be raised on that Dispatcher,
    Key here is get the dispatcher of UIthread before hand.

    UIDisaptcher.BeginInvoke((ThreadStart)(() => RaiseEventToUIThread()));

    when the UI thread listens to the raised event it can set the Owner property(as the window was created by the UI thread).

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

Sidebar

Related Questions

I have the main thread from which I start a window using invokeLater .
My complete GUI runs inside the AWT thread, because I start the main window
Suppose I have thread 1, the main window UI thread and thread 2, a
I have a windows form on the main thread and another thread that does
I have a window(say main window) with a frame which has a page in
I want to create an application which main window has canvas (or something where
I have thread in onCreate which is getting content from web. While the content
I've implemented a simple WPF splash screen window which informs the user about the
I have a class called GUIMain which registers, creates, and shows a main window
I have a main form, which is invisible and at some point creates a

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.