コード例 #1
0
ファイル: HomeView.cs プロジェクト: hojm/Hanselman.Forms
		public HomeView ()
		{
			pages = new Dictionary<MenuType, NavigationPage> ();
			BindingContext = new HomeViewModel ();

			Master = master = new HomeMasterView (ViewModel);

			var homeNav = new NavigationPage(master.PageSelection) {
        BarBackgroundColor = Helpers.Color.DarkBlue.ToFormsColor(),
        BarTextColor = Color.White
			};
			Detail = homeNav;

			pages.Add (MenuType.About, homeNav);

			master.PageSelectionChanged = (menuType) => {
			
				NavigationPage newPage;
				if(pages.ContainsKey(menuType)){
					newPage = pages[menuType];
				}
				else{
					newPage = new NavigationPage(master.PageSelection){
						BarBackgroundColor = Helpers.Color.DarkBlue.ToFormsColor(),
            BarTextColor = Color.White
					};
					pages.Add (menuType, newPage);
				}
				Detail = newPage;
				Detail.Title = master.PageSelection.Title;
				IsPresented = false;
			};

			this.Icon = "slideout.png";
		}
コード例 #2
0
        public HomeView()
        {
            pages          = new Dictionary <MenuType, NavigationPage> ();
            BindingContext = new HomeViewModel();

            Master = master = new HomeMasterView(ViewModel);

            var homeNav = new NavigationPage(master.PageSelection)
            {
                BarBackgroundColor = Helpers.Color.DarkBlue.ToFormsColor(),
                BarTextColor       = Color.White
            };

            Detail = homeNav;

            pages.Add(MenuType.About, homeNav);

            master.PageSelectionChanged = async(menuType) => {
                if (Detail != null && Device.OS == TargetPlatform.WinPhone)
                {
                    await Detail.Navigation.PopToRootAsync();
                }

                NavigationPage newPage;
                if (pages.ContainsKey(menuType))
                {
                    newPage = pages[menuType];
                }
                else
                {
                    newPage = new NavigationPage(master.PageSelection)
                    {
                        BarBackgroundColor = Helpers.Color.DarkBlue.ToFormsColor(),
                        BarTextColor       = Color.White
                    };
                    pages.Add(menuType, newPage);
                }
                Detail       = newPage;
                Detail.Title = master.PageSelection.Title;
                IsPresented  = false;
            };

            this.Icon = "slideout.png";
        }
コード例 #3
0
        public HomeView()
        {
            pages          = new Dictionary <MenuType, NavigationPage> ();
            BindingContext = new HomeViewModel();

            Master = master = new HomeMasterView(ViewModel);

            var homeNav = new NavigationPage(master.PageSelection)
            {
                Tint = Helpers.Color.DarkBlue.ToFormsColor()
            };

            Detail = homeNav;

            pages.Add(MenuType.About, homeNav);

            master.PageSelectionChanged = (menuType) => {
                NavigationPage newPage;
                if (pages.ContainsKey(menuType))
                {
                    newPage = pages[menuType];
                }
                else
                {
                    newPage = new NavigationPage(master.PageSelection)
                    {
                        Tint = Helpers.Color.DarkBlue.ToFormsColor()
                    };
                    pages.Add(menuType, newPage);
                }
                Detail       = newPage;
                Detail.Title = master.PageSelection.Title;
                IsPresented  = false;
            };

            this.Icon = "slideout.png";
        }