Skip to content

Instantly share code, notes, and snippets.

@bbenetskyy
Created September 13, 2019 07:05
Show Gist options
  • Save bbenetskyy/a11dee25934ca88ac31e08bb8fbcc0d3 to your computer and use it in GitHub Desktop.
Save bbenetskyy/a11dee25934ca88ac31e08bb8fbcc0d3 to your computer and use it in GitHub Desktop.
MvxTabbedPage ViewModel with navigation for all child tabs
public class HomeViewModel : MvxViewModel
{
private readonly IMvxNavigationService _navigationService;
private bool _firstTime = true;
private IMvxViewModel _previousViewModel;
public HomeViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
}
private Task ShowInitialViewModels()
{
var tasks = new List<Task>
{
_navigationService.Navigate<DetailsViewModel>(),
_navigationService.Navigate<SecondDetailsViewModel>(),
_navigationService.Navigate<ThirdDetailsViewModel>()
};
return Task.WhenAll(tasks);
}
public override void ViewAppearing()
{
if (_firstTime)
{
ShowInitialViewModels();
_firstTime = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment