예제 #1
0
        public CoursePage(PluralsightCourse course)
        {
            Padding         = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
            BackgroundColor = Color.Gray;

            this.Title = course.TitleShort;

            var titleLabel = new Label
            {
                Text = course.Title,
                Font = Font.SystemFontOfSize(NamedSize.Large)
            };

            var authorLabel = new Label
            {
                Text = course.Author,
                Font = Font.SystemFontOfSize(NamedSize.Small)
            };

            var descriptionLabel = new Label
            {
                Text = course.Description,
                Font = Font.SystemFontOfSize(NamedSize.Medium)
            };

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    Spacing  = 10,
                    Children = { titleLabel, authorLabel, descriptionLabel }
                }
            };
        }
        public CourseMasterDetailDB()
        {
            var listView = new ListView();

            listView.ItemsSource = PluralsightCourse.GetCourseList();

            listView.ItemSelected += (sender, e) => {
                if (e.SelectedItem != null)
                {
                    Detail.BindingContext = e.SelectedItem;
                    IsPresented           = false;
                }
            };

            // represents the master page
            Master = new ContentPage
            {
                Title   = "Courses",
                Content = listView
            };

            Detail = new CoursePageDB();
            Detail.BindingContext = PluralsightCourse.GetCourseList().First();
        }
예제 #3
0
        public HomePage()
        {
            Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 0);
            Title   = "Pages";

            var button1 = new Button {
                Text = "Simple Page"
            };

            button1.Clicked += (o, e) => {
                Navigation.PushAsync(new CoursePage(PluralsightCourse.GetCourseList().First()));
            };

            var button2 = new Button {
                Text = "Master/Detail"
            };

            button2.Clicked += (o, e) => {
                Navigation.PushAsync(new CourseMasterDetail());
            };

            var button3 = new Button {
                Text = "Master/Detail(binding)"
            };

            button3.Clicked += (o, e) => {
                Navigation.PushAsync(new CourseMasterDetailDB());
            };

            var button4 = new Button {
                Text = "Tabbed"
            };

            button4.Clicked += (o, e) => {
                var page = new TabbedPage();
                page.Title = "Courses";
                foreach (var course in PluralsightCourse.GetCourseList())
                {
                    var coursePage = new CoursePageDB();
                    coursePage.BindingContext = course;
                    page.Children.Add(coursePage);
                }

                Navigation.PushAsync(page);
            };

            var button5 = new Button {
                Text = "Carousel"
            };

            button5.Clicked += (o, e) => {
                var page = new CarouselPage();
                page.Title = "Courses";
                foreach (var course in PluralsightCourse.GetCourseList())
                {
                    var coursePage = new CoursePageDB();
                    coursePage.BindingContext = course;
                    page.Children.Add(coursePage);
                }

                Navigation.PushAsync(page);
            };

            Content = new StackLayout
            {
                Spacing  = 10,
                Children = { button1, button2, button3, button4, button5 }
            };
        }