This is XAML with a button and 3 progress bars
TestBtn
this is the thread to update the 3 progress bars..
Thread thread = new Thread(
new ThreadStart(
delegate()
{
progressBar1.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
int x=0;
while(true)
{
x++;
Thread.Sleep(50);
progressBar1.Value = x;
if (x>100)
{
break;
}
}
MessageBox.Show(" Complete ");
}
));
progressBar2.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
int y = 0;
while (true)
{
Thread.Sleep(50);
y = y + 2;
progressBar2.Value = y;
if (y > 100)
{
break;
}
}
MessageBox.Show(" Complete ");
}
));
progressBar3.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
int z = 0;
while (true)
{
Thread.Sleep(50);
z = z + 3;
progressBar3.Value = z;
if (z > 100)
{
break;
}
}
MessageBox.Show(" Complete ");
}
));
)
);//end of thread
thread.Start();
}
when i run this, all the 3 progress bars are updated to 100 percent at last(all are reaching directly to 100 at the same time) and it is not showing any increments from 0 to 100.
What i need is a thread with 3 item , where each will update the UI at the same time.So here at the same time all these 3 progress bars have to start and they have finish according to the loop.. (When we are copying files, in the UI , copying description is changing at the same time progress bar has to be updated.I want similar to that.So i think if i can understand a small example like this, then i can sort the required one)
pls correct me, where i cam wrong. Thnks Kaja