예제 #1
0
        public Page GetTimeline()
        {
            var listView = new ListView
            {
                HasUnevenRows = true
            };

            listView.ItemsSource  = TwitterService.Search();
            listView.ItemTemplate = new DataTemplate(() =>
            {
                Image userImage = new Image();
                userImage.SetBinding(Image.SourceProperty, "ImageUri");

                Label nameLabel = new Label();
                nameLabel.SetBinding(Label.TextProperty, "Name");

                HtmlLabel tweetLabel = new HtmlLabel();
                tweetLabel.SetBinding(Label.TextProperty, "Value");

                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        Orientation = StackOrientation.Vertical,
                        Children =
                        {
                            new StackLayout
                            {
                                Padding = new Thickness(0, 5),
                                Orientation = StackOrientation.Horizontal,
                                Children =
                                {
                                    userImage,
                                    nameLabel
                                }
                            },
                            tweetLabel
                        }
                    }
                });
            });

            return(new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    Children = { listView }
                }
            });
        }