I'm currently modifying a UserControl to remove NotifyTaskCompletion class and use directly the Task with SetPropertyAndNotifyOnCompletion .
I am working on a .NET 4.8 project in WPF and I have the following problem:
Constructor
public ArticleCategoryUserControlModel()
{
_serviceProvider = ApplicationBootstrapper.ServiceProvider;
AllArticleCategoriesTask = RequestValuesAsync();
}
private async Task<ObservableCollection<IArticleCategoryBusinessModel>> RequestValuesAsync()
{
using var scope = _serviceProvider.CreateScope();
var articleCategoryReader = scope.ServiceProvider.GetRequiredService<IArticleCategoryReader>();
await Task.Delay(3000); // for debug purpose
var res = await articleCategoryReader.GetAllAsync();
return new ObservableCollection<IArticleCategoryBusinessModel>(res);
}
Currently I am still using the following result wrapper:
My question is the following: Is it possible to do the same behavior without the AllArticleCategoriesResult property?
In the Xaml, I can't directly use AllArticleCategories.Result because it causes me to freeze the UI. I have to use the AllArticleCategoriesResult property.
Hello,
I'm currently modifying a UserControl to remove NotifyTaskCompletion class and use directly the Task with SetPropertyAndNotifyOnCompletion .
I am working on a .NET 4.8 project in WPF and I have the following problem: Constructor
Currently I am still using the following result wrapper:
Corresponding Xaml
My question is the following: Is it possible to do the same behavior without the AllArticleCategoriesResult property?
In the Xaml, I can't directly use AllArticleCategories.Result because it causes me to freeze the UI. I have to use the AllArticleCategoriesResult property.
Thanks