WPF Progress bar

  • Thread starter Thread starter sonny
  • Start date Start date
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();
}
}
 
Back
Top