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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:10:01+00:00 2026-06-02T08:10:01+00:00

I am having issues updating a separately opened window’s progress bar from a background

  • 0

I am having issues updating a separately opened window’s progress bar from a background worker inside another class.

The program execution goes like this:

  1. MainWindow loads
  2. Click button to do some work and open a popup
    progress bar (newly opened window)
  3. Background worker does work
    and reports progress to popup progress bar
  4. Popup progress bar
    hopefully updates.

The progress bar Value is bound to a property, which in the step-through debugger, looks to be getting updated okay by the background worker. These changes just are not reflected on the popup progress bar view. However, the binding is not broken because if I manually try and set the property value for the progress bar it works fine.

Furthermore, when I put the progress bar inside the initially started MainWindow view it updates fine. Any suggestions??

Here is the some code:

MainWindowViewModel

public class MainWindowViewModel: BaseViewModel
{

    private void PerformSomeAction()
    {
        var popUpProgressBar = new PopUpProgressBarViewModel();
        popUpProgressBar.Show(popUpProgressBar);

        var worker = new BackgroundWorker { WorkerReportsProgress = true };

        worker.ProgressChanged += delegate(object s, ProgressChangedEventArgs args)
        {
            if (args.ProgressPercentage != popUpProgressBar.Progresser)
            {
                Progresser = args.ProgressPercentage;
                popUpProgressBar.Progresser = args.ProgressPercentage;
            }
        };

        worker.DoWork += delegate
        {


            for (int i = 0; i < 101; i++)
            {
                worker.ReportProgress(i);
                System.Threading.Thread.Sleep(10);
            }


            MessageBox.Show("Done");
        };

            worker.RunWorkerAsync();

    }


    private int _progresser;
    public int Progresser
    {
        get { return _progresser; }
        set
        {
            if (_progresser == value) return;
            _progresser = value;
            OnPropertyChanged("Progresser");
        }
    }

    private RelayCommand _startProcessing; //set private member
    public ICommand StartProcessing //public field used by xaml binding
    {
        get
        {
            return _startProcessing = MakeCommandSafely(_startProcessing, () => PerformSomeAction());
        }
    }
}

PopUpProgressBarViewModel

public class PopUpProgressBarViewModel : BaseViewModel
{
    private PopUpProgressBar _popUpProgressBar;

    public void Show(PopUpProgressBarViewModel context)
    {
        _popUpProgressBar = new PopUpProgressBar {DataContext = context};
        _popUpProgressBar.Show();
    }

    private int _progresser;
    public int Progresser
    {
        get { return _progresser; }
        set
        {
            if (_progresser == value) return;
            _progresser = value;
            OnPropertyChanged("Progresser");
        }
    }
}

For full solution file (so you can see whats happening), see here

  • 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-02T08:10:05+00:00Added an answer on June 2, 2026 at 8:10 am

    As @Doug said, since you are already setting the DataContext:

     _popUpProgressBar = new PopUpProgressBar {DataContext = context};
    

    You can change the PopUpProgressBar to

     <Window x:Class="OpeningWindow_With_ProgressBar.View.PopUpProgressBar"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ViewModel="clr-namespace:OpeningWindow_With_ProgressBar.ViewModel" Title="PopUpProgressBar" Height="150" Width="300">
    
    <Grid>
    
        <StackPanel>
            <Label FontWeight="Bold">Loading Something</Label>
            <ProgressBar Minimum="0" Maximum="100" Margin="0,10,0,0" Height="25px" Width="250px" Value="{Binding Path=Progresser, Mode=OneWay}"></ProgressBar>
            <TextBlock Margin="10,10,0,0" Text="Details of loading..."></TextBlock>
        </StackPanel>
    
    </Grid>
    

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

Sidebar

Related Questions

I'm having some issues updating a dependency property from a standard property. If I
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Im having issues vertically positioning text inside of a text input field in Firefox.
Okay, so I'm having issues getting the value of a DropDownList that's inside of
I'm having issues with updating a select stored procedure in the model browser. Deleting
I am having some issues when updating an object that has a nested attribute.
I'm new to both C# and MongoDB and am having some issues inserting/updating/savings items
I'm having an issue when trying to update a progress bar. When I update
Still having issues with this problem. Please help if you can. So I am
Im having issues getting this to work, maybe its not even possible? I have

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.