In my FolderViewModel, I have
public string FolderPath
{
get
{
if (folderPath == null)
{
GetFolderPathAsync();
return "Loading...";
}
return folderPath;
}
set
{
folderPath = value;
Changed(nameof(FolderPath));
}
}
GetFolderPathAsync is an async method which makes server calls to fetch the path and Sets FolderPath.
Now in another class, I create folderviewmodels and set their paths this way
folderViewModel.FolderPath = parent.FolderPath+"/"+folder.Name;
The problem is get is that, the path ends up getting set to "Loading.../foldername" and never updates when the parent folder's folderpath updates from "loading..." after its been fetched from the server. how can i fix ths? Im not great with threading so i really dont know how to fix this. i was wondering if there is a way i could make the setting of folderPath wait for the GetFolderPathAsync to finish somehow?
thanks for the help!