WPF Progress bar

S

sonny

Hi,
I'm trying to write my first "intro to" WPF application.

I have a background process running and I want to display a form with a
progress bar on it to show the user that something is going on. The progress
bar doesn't show any progress until after the loop. What am I doing wrong?

Here is my code behind....thx

public partial class LoadingWait : Window
{
public LoadingWait()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(LoadingWait_Loaded);
}

private void StartMovement()
{
progressBar.Minimum = 0;
progressBar.Maximum = 100;

progressBar.Value = progressBar.Minimum;
while (progressBar.Value < progressBar.Maximum)
{
progressBar.Value += 1;
//if (progressBar.Value == progressBar.Maximum)
// progressBar.Value = 0;
System.Threading.Thread.Sleep(100);
}
}
void LoadingWait_Loaded(object sender, RoutedEventArgs e)
{
StartMovement();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top