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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:29:42+00:00 2026-06-13T14:29:42+00:00

I have a Threading.timer that show a ballon in a special time. I use

  • 0

I have a Threading.timer that show a ballon in a special time.

I use this code for show Balloon

 var thread = new Thread(new ThreadStart(DisplayFormThread));

        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();
        thread.Join();

 private void DisplayFormThread()
{
    try
    {
        Show();
    }
    catch (Exception ex)
    {
        //  Log.Write(ex);
    }
}

it is my class for show ballon .

 if (!Application.Current.Dispatcher.CheckAccess())
    {
        var action = new Action(() => ShowCustomBalloon(balloon, animation, timeout));
        Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, action);
        return;
    }

    if (balloon == null) throw new ArgumentNullException("balloon");
    if (timeout.HasValue && timeout < 500)
    {
        string msg = "Invalid timeout of {0} milliseconds. Timeout must be at least 500 ms";
        msg = String.Format(msg, timeout);
        throw new ArgumentOutOfRangeException("timeout", msg);
    }

    Popup popup = new Popup();
    popup.AllowsTransparency = true;
    popup.PopupAnimation = animation;
    popup.Child = balloon;
    popup.Placement = PlacementMode.AbsolutePoint;
    popup.StaysOpen = true;

    Point position = new Point(SystemParameters.WorkArea.Width - ((UserControl)balloon).Width,
             SystemParameters.WorkArea.Height - ((UserControl)balloon).Height);
    popup.HorizontalOffset = position.X - 1;
    popup.VerticalOffset = position.Y - 1;
    //display item
    popup.IsOpen = true;

when i show the balloon i get error :The calling thread cannot access this object because a different thread owns it

in this code i get error :

popup.Child = balloon;

  • 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-13T14:29:43+00:00Added an answer on June 13, 2026 at 2:29 pm

    You cannot update UI directly from another thread. When you are done in the thread and need to update the UI then you can use following:

    this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (System.Threading.ThreadStart)delegate()
    {
        // Update UI properties
    });
    

    “this” is a UI element for example the window. You can also use:

    System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (System.Threading.ThreadStart)delegate()
    {
        // Update UI properties
    });
    

    instead of reference to the UI component i.e. “this” in the example above.

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

Sidebar

Related Questions

I have an issue with System.Threading.Timer. I am scheduling some actions using a time
I have some DateTime variable, and I want to use System.Threading.Timer to wait until
I have a problem with This code in C# : main class { var
Let's say I have this blob of code that's made to be one long-running
I have a Windows Service application which uses a Threading.Timer and a TimerCallback to
I have been checking out some of the possible timers lately, and System.Threading.Timer and
I have a java threading code. I have 3 threads, I have given names
I believe I have a potential threading issue. I have a user control that
I have a loop and within that loop I'm running a Dispatcher Timer. Here's
I am new with this stuff of Threading in Delphi. so, I am trying

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.