i have a Planner Application project , i have created a waiting User Control For The Times When i get the data from Database to show the progress to the user , so i write this codes for this purpose :
public void LoadDestinationList()
{
Dispatcher.Invoke(new Action(() =>
{
WS_PPB.Value = 10;
RDFDB_Class MyClass = new RDFDB_Class(TaskType);
WS_PPB.Value = 25;
Thread MyThread = new Thread(new ThreadStart(MyClass.LoadDataFromDb));
WS_PPB.Value = 40;
MyThread.IsBackground = true;
MyThread.Start();
WS_PPB.Value = 55;
while (MyThread.IsAlive)
{
WS_PPB.Value = 75;
}
WS_PPB.Value = 100;
}));
}
but i don't know why The UserControl Loaded after the data retrieved from the data base and it only show 100% in the progressbar , could you tell me what is wrong here ? please help me to fix this problem.