Example #1
0
        private ListView CreateMatchesListView()
        {
            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "Title");
            cell.SetValue(TextCell.TextColorProperty, Color.Black);

            //cell.SetValue(TextCell.TextProperty, Font.SystemFontOfSize(NamedSize.Micro));

            var listView = new ListView
            {
                RowHeight    = 40,
                ItemTemplate = cell
            };

            listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Title");
            listView.ItemTapped += async(sender, e) =>
            {
                var soccerEvent = (SoccerEvent)e.Item;
                var detailsPage = new DetailsPage(soccerEvent.EventId);
                await Navigation.PushAsync(detailsPage);
            };

            var soccerEvents = new SoccerEventsService().Get();

            soccerEvents.ContinueWith((task) =>
            {
                listView.ItemsSource = task.Result;
            },
                                      TaskScheduler.FromCurrentSynchronizationContext());

            return(listView);
        }
Example #2
0
        public GenrePage(Genre genre)
        {
            var listView = SetupListView();

            Content = new StackLayout
            {
                Spacing  = 10,
                Children = { listView }
            };

            var soccerEvents = new SoccerEventsService().Get();

            soccerEvents.ContinueWith((task) =>
            {
                listView.ItemsSource = task.Result;
            },
                                      TaskScheduler.FromCurrentSynchronizationContext());
        }