public MenuPage(RootPage root) { this.root = root; InitializeComponent(); BindingContext = new BaseViewModel { Title = "BizDeducter" }; ListViewMenu.ItemsSource = menuItems = new List<NavigationItem> { new NavigationItem { Name = "Home", Id = PageId.Home }, new NavigationItem { Name = "Tax Calendar", Id = PageId.TaxCalendar }, new NavigationItem { Name = "Tax Bracket Calc", Id = PageId.TaxBracket } }; ListViewMenu.SelectedItem = menuItems[0]; ListViewMenu.ItemSelected += async (sender, e) => { if(ListViewMenu.SelectedItem == null) return; await this.root.NavigateAsync(((NavigationItem)e.SelectedItem).Id); }; }
public App() { // The root page of your application MainPage = new RootPage(); /* var button = new Button { Text = "Click Me" }; button.Clicked += (sender, e) => { MainPage = new RootPage(); }; MainPage = new ContentPage { Title = "Hello Tom", Content = button };*/ }