0
I have a Progressring on a Page in WPF that needs to be displayed while the Grid is being loaded (Goal: Show the user that you are loading) and then be disabled when loading it has been completed. Only you’re making that mistake:
public ClienteListPage()
{
InitializeComponent();
carregar();
}
public void carregar()
{
prProgresso.IsActive = true;
Task.Factory.StartNew(() =>
{
DataContext = App.container.GetService<IClientesListarController>();
}).ContinueWith(task =>
{
prProgresso.IsActive = false;
if (task.IsFaulted)
{
Console.WriteLine("{0} Exception caught.", task.Exception);
MessageBox.Show("Error");
}
}, System.Threading.CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
}
Someone knows how to help me?
Thanks for the return Thiago, but I can’t find this component in my Tools box. It works with WPF even?
– Master JR
add the reference to using System.Componentmodel; more information here: https://stackoverflow.com/questions/5483565/how-to-use-wpf-background-worker
– Thiago Loureiro