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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:36:00+00:00 2026-05-26T19:36:00+00:00

I have a textbox on a window that reports the status and or success

  • 0

I have a textbox on a window that reports the status and or success of a action. It’s bound to a property on the ViewModel.

So when a user activates the action that could take some time I wan’t to let him know that the action has started in the textBox. Problem is that he doesn’t write into the textbox until after the action has finished.

I guess it’s because the thread doesn’t give the UI the chance to do it’s work but not sure.

public class ViewModel : INotifyPropertyChanged
{
        private string _report;
        public string Report
        {
            get { return _report; }
            set
            {
                _report = value;
                RaisePropertyChanged("Report");
            }
        }

        public void DoHeavyAction()
        {
            Report += "Heavy action readying";

            ReadyHeavyAction();

            Report += "Heavy action starting";

            var result = DoTheHeavyAction();

            if(!result.success)
            {
                report += "Heavy action failed";
                return;
            }

            Report += result.value;
        }
}

In this case the program lags for 2 seconds and then the whole thing appears:

Heavy action readying
Heavy action starting
Heavy action failed

Instead of appearing one by one.

Can I somehow use the dispatcher to update the View (note I’m using MVVM).

  • 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-26T19:36:01+00:00Added an answer on May 26, 2026 at 7:36 pm

    Yes, it’s easy. Your heavy operation runs in a separate thread, and you report the progress as

    Dispatcher.Invoke((Action)(() => {
        Report.value = "Started";
    }));
    

    Edit:
    In the actual case the operation is activated by an ICommand. The said ICommand is dispatched from the UI, therefore it comes in the UI thread. So the problem is that the UI (and its update) is blocked by the heavy operation.

    The solution would be to start a new thread on the command arrival, and do the work there. The UI can be updated using the code like the example above.

    There are some alternative approaches to this solution, but all of them are anyway starting the task in the background thread, although implicitly. A popular and good one is using a BackgroundWorker and updating the state in its ProgressChanged event (note that this event comes in the UI thread, so you don’t need to use the Dispatcher in this case).

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

Sidebar

Related Questions

I have a TextBox in a WPF window bound to a dependency property of
I have a TextBox in a Windows Form that allows a user to enter
Desktop window application. I have textbox in which user give values in numbers. what
I have a Window that has two primary areas. One is a TextBox inside
I have a WPF Window that contains a TextBox. I have implemented a Command
I have a textbox that I want to be watermarked. In my window.resources section
I have a user control that is nested inside a window that is acting
I have multi-lines textbox in c# window-base application. If user click on textbox I
I have a UserControl which contains a TextBox . When my main window loads
I have a WPF window that uses validation. I created an error template that

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.