public AboutView() { this.Content = new StackLayout() { Orientation = StackOrientation.Vertical, Children = { new Label { Text = "About View!", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }, new Button { Text = "Show FeedbackView", Command = new Command(p => { // Solution #1 // MainView mv = new MainView(); // mv.Detail = new NavigationPage(new FeedbackView()); // // App.Current.MainPage = mv; // Solution #2 FeedbackView fv = new FeedbackView(); MessagingCenter.Send <FeedbackView> (fv, "OpenInDetail"); }) } } }; }
public AboutView() { this.Content = new StackLayout() { Orientation = StackOrientation.Vertical, Children = { new Label { Text = "About View!", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }, new Button { Text = "Show FeedbackView", Command = new Command(p => { // Solution #1 // MainView mv = new MainView(); // mv.Detail = new NavigationPage(new FeedbackView()); // // App.Current.MainPage = mv; // Solution #2 FeedbackView fv = new FeedbackView(); MessagingCenter.Send<FeedbackView> (fv, "OpenInDetail"); }) } } }; }
public MasterView(MenuViewModel viewModel) { this.BindingContext = viewModel; this.Title = "Title"; var layout = new StackLayout { Spacing = 0 }; var listView = new ListView(); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(TextCell.TextProperty, MenuViewModel.TitlePropertyName); cell.SetBinding(ImageCell.ImageSourceProperty, "Icon"); listView.ItemTemplate = cell; listView.ItemsSource = viewModel.MenuItems; if (about == null) about = new AboutView(); PageSelection = about; listView.ItemSelected += (sender, args) => { var menuItem = listView.SelectedItem as HomeMenuItem; menuType = menuItem.MenuType; switch (menuItem.MenuType) { case MenuType.Home: if (home == null) home = new HomeView(); PageSelection = home; break; case MenuType.About: if (about == null) about = new AboutView(); PageSelection = about; break; case MenuType.Feedback: if (feedback == null) feedback = new FeedbackView(); PageSelection = feedback; break; } }; listView.SelectedItem = viewModel.MenuItems[0]; layout.Children.Add(listView); this.Content = layout; }
public MasterView(MenuViewModel viewModel) { this.BindingContext = viewModel; this.Title = "Title"; var layout = new StackLayout { Spacing = 0 }; var listView = new ListView(); var cell = new DataTemplate(typeof(ImageCell)); cell.SetBinding(TextCell.TextProperty, MenuViewModel.TitlePropertyName); cell.SetBinding(ImageCell.ImageSourceProperty, "Icon"); listView.ItemTemplate = cell; listView.ItemsSource = viewModel.MenuItems; if (about == null) { about = new AboutView(); } PageSelection = about; listView.ItemSelected += (sender, args) => { var menuItem = listView.SelectedItem as HomeMenuItem; menuType = menuItem.MenuType; switch (menuItem.MenuType) { case MenuType.Home: if (home == null) { home = new HomeView(); } PageSelection = home; break; case MenuType.About: if (about == null) { about = new AboutView(); } PageSelection = about; break; case MenuType.Feedback: if (feedback == null) { feedback = new FeedbackView(); } PageSelection = feedback; break; } }; listView.SelectedItem = viewModel.MenuItems[0]; layout.Children.Add(listView); this.Content = layout; }