Ejemplo n.º 1
0
        public App()
        {
            var items =
                Device.OS == TargetPlatform.iOS ? Demos.SamplesForPlatform(Demos.Platform.iOS) :
                Device.OS == TargetPlatform.Android ? Demos.SamplesForPlatform(Demos.Platform.Android) :
                Device.OS == TargetPlatform.Windows ? Demos.SamplesForPlatform(Demos.Platform.UWP) :
                Demos.SamplesForPlatform(Demos.Platform.All);

            var masterDetail = new MasterDetailPage
            {
                IsGestureEnabled = true,
                MasterBehavior   = MasterBehavior.Popover
            };
            var detailPage = new DetailsPage(items.First());
            var navPage    = new NavigationPage(detailPage)
            {
                BarBackgroundColor = XamarinBlue,
                BarTextColor       = Color.White,
            };
            var masterPage = new MasterPage(items, demo =>
            {
                masterDetail.IsPresented = false;
                detailPage.SetDemo(demo);
                navPage.Title = demo;
            });

            if (Device.OS == TargetPlatform.iOS)
            {
                masterPage.Icon = "hamburger.png";
            }

            masterDetail.Master = masterPage;
            masterDetail.Detail = navPage;

            MainPage = masterDetail;

            masterDetail.IsPresented = true;
        }
Ejemplo n.º 2
0
        public App()
        {
            var items =
                Device.OS == TargetPlatform.iOS ? Demos.SamplesForPlatform(Demos.Platform.iOS) :
                Device.OS == TargetPlatform.Android ? Demos.SamplesForPlatform(Demos.Platform.Android) :
                Device.OS == TargetPlatform.Windows ? Demos.SamplesForPlatform(Demos.Platform.UWP) :
                Demos.SamplesForPlatform(Demos.Platform.All);

            var masterDetail = new MasterDetailPage
            {
                IsGestureEnabled = true,
                MasterBehavior = MasterBehavior.Popover
            };
            var detailPage = new DetailsPage(items.First());
            var navPage = new NavigationPage(detailPage)
            {
                BarBackgroundColor = XamarinBlue,
                BarTextColor = Color.White,
            };
            var masterPage = new MasterPage(items, demo =>
            {
                masterDetail.IsPresented = false;
                detailPage.SetDemo(demo);
                navPage.Title = demo;
            });
            if (Device.OS == TargetPlatform.iOS)
            {
                masterPage.Icon = "hamburger.png";
            }

            masterDetail.Master = masterPage;
            masterDetail.Detail = navPage;

            MainPage = masterDetail;

            masterDetail.IsPresented = true;
        }