public BaseMenuItem(IMasterPageService masterPageService)
        {
            _masterPageService = masterPageService;

            NavigateToRootPageCommand = new Command <string>((param) =>
            {
                _masterPageService.SetRootPage(param);
            });
        }
Exemple #2
0
        //private void GoToPage()
        //{
        //     _selectedMenuItem?.NavigateCommand.Execute(null);
        //}

        public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = (IMasterPageMenuItem)e.SelectedItem;

            _masterPageService.SetRootPage(item.PageKey);
            //var item = e.SelectedItem as IMasterPageMenuItem;
            //if (item != null)
            //{
            //    Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
            //    masterPage.ListView.SelectedItem = null;
            //    IsPresented = false;
            //}
        }
        public Page2Sub1ViewModel(INavigationService navigationService, IMasterPageService masterPageService) : base(navigationService)
        {
            _navigationService = navigationService;
            _masterPageService = masterPageService;

            Command1 = new Command(async() =>
            {
                //TODO: try moving this logic to masterpageservice.
                //if navigation is the current, then pop the old first.
                await _navigationService.PopToRootPageAsync();

                _masterPageService.SetRootPage(ViewNames.Page1);
            });
        }