Hello,
i have TabbedPage, which every tab needs to be filled with different data. My REST request works but the data ist not available at the time i need it.
in My RootPage where everything starts i create a Master Detail Page which includes
var tabbedPage = new TabbedPage {
Title = "Open Tasks",
Children = {
openTasks,
completedTasks,
missedTasks
},
CurrentPage = openTasks,
};
also their i execute my call on the start
protected override void OnAppearing (){
ViewModel.TaskCommand.Execute (null);
}
In my MainViewModel i have following
public Command TaskCommand {
get { return taskCommand ?? (taskCommand = new Command (async () => await ExecuteTaskCommand ())); }
}
public async Task ExecuteTaskCommand ()
{
if (IsBusy) {
return;
}
IsBusy = true;
try{
var taskResponse = await teamService.GetTasks();
foreach (var task in taskResponse) {
Tasks.Add(task);
}
OnPropertyChanged("Tasks");
} catch (Exception ex) {
Debug.WriteLine (ex);
}
IsBusy = false;
}
When i Debug.WriteLine in my MainViewModel it gets the Data. But when i try to acces the data in my RootPage ViwModel.Tasks are empty.
I think thats a problem with the asynchronous but i don't really know how to handle this.