Roland Deschain
Roland Deschain

Reputation: 2840

WPF Progressbar with two states (busy and progress)

I have a simple program which has two long running tasks to perform:

  1. copying a lot of folders containing databases
  2. working with those copied databases.

What I want to do is the following: These long running process run in an extra thread with different variables which update my GUI - so for example the current progress bar is working, also all messages I need to show on the GUI. However, at the moment, I can use the progress bar only for the second task (working with the databases) - the copying of the folders and files is done in a recoursive way (calling itself for every subfolder, that needs to be copied) and I don't know how many folders will be copied. Therefore while the copying is going on, I want the progress bar to show a busy indication (like this one), and after it's finished it should be a standard progress bar for the work on the dbs.

Is such a solution possible in a clean way?

Upvotes: 1

Views: 1266

Answers (1)

Ralt
Ralt

Reputation: 2166

In WPF, the ProgressBar has a property IsIndeterminate which does exactly this.

<ProgressBar IsIndeterminate="True" />

When set to true, the the progress bar will infinitely 'spin' and will not show progress within a range.

Upvotes: 6

Related Questions