public HomeMasterView(HomeViewModel viewModel)
        {
            this.Icon = "hamburger.png";
            BindingContext = viewModel;

            var layout = new StackLayout { Spacing = 0 };

            if (Device.OS == TargetPlatform.iOS)
            {
                var label = new ContentView
                {
                    Padding = new Thickness(5, 30, 5, 15),
                    BackgroundColor = Color.FromHex("#ebebeb"),

                    Content = new Image
                    {
                        Source = ImageSource.FromFile("drawer.png"),
                        Scale = 1.0,
                    }
                };
                layout.Children.Add(label);
            }
            else
            {
                var label = new ContentView
                {
                    Padding = new Thickness(0, 10, 1, 10),
                    BackgroundColor = Color.FromHex("#ebebeb"),

                    Content = new Image
                    {
                        Source = ImageSource.FromFile("drawer.png"),
                        Scale = 1.0,
                    }
                };
                layout.Children.Add(label);
            }

            var listView = new ListView();

            DataTemplate cell = null;

            if (Device.OS == TargetPlatform.Windows)
            {
                cell = new DataTemplate(typeof(FancyListCell));
                this.BackgroundColor = Color.FromHex("f2f2f2");
            }
            else
            {
                cell = new DataTemplate(typeof(MasterMenuCell));
                cell.SetBinding(TextCell.TextProperty, HomeViewModel.TitlePropertyName);
            }

            listView.ItemTemplate = cell;
            listView.SeparatorVisibility = SeparatorVisibility.Default;
            listView.SeparatorColor = Color.FromHex("#ababab");

            listView.ItemsSource = viewModel.MenuItems;
            listView.SelectedItem = viewModel.MenuItems[0];
            if (favorites == null)
                favorites = new FavoritesPage();

            PageSelection = favorites;
            //Change to the correct page
            listView.ItemSelected += (sender, args) =>
            {
                var menuItem = listView.SelectedItem as MasterNavItem;
                menuType = menuItem.MenuType;
                switch (menuItem.MenuType)
                {

                case MenuType.Favorites:
                    var favpage = new FavoritesPage();

                    PageSelection = favpage;
                    break;

                }
            };

            listView.SelectedItem = viewModel.MenuItems[0];
            layout.Children.Add(listView);

            Content = layout;
        }
        public MasterDetailNavPage()
        {
            pages = new Dictionary<MenuType, NavigationPage>();
            BindingContext = new HomeViewModel();

            Master = master = new HomeMasterView(ViewModel);

            var homeNav = new NavigationPage(master.PageSelection)
            {
                BarBackgroundColor = Color.FromHex("#ebebeb"),
                BarTextColor = Color.FromHex("#912823")
            };
            Detail = homeNav;

            pages.Add(MenuType.Issues, 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 = Color.FromHex("#ebebeb"),
                        BarTextColor = Color.FromHex("#912823")
                    };
                    pages.Add(menuType, newPage);
                }
                Detail = newPage;
                Detail.Title = master.PageSelection.Title;
                if(Device.Idiom != TargetIdiom.Tablet)
                    IsPresented = false;
            };

            this.Icon = "hamburger.png";
            this.MasterBehavior = MasterBehavior.Popover;
        }