public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _collectionView = new YouTubeCollectionView()
            {
                PageSize = 25
            };
            Grid.AutoGenerateColumns = false;
            Grid.AllowMerging        = GridAllowMerging.ColumnHeaders;
            Grid.Columns.Add(new GridImageColumn {
                Binding = "Thumbnail", Header = "Title", Width = new GridLength(70), ImagePadding = new UIEdgeInsets(4, 4, 4, 0), PlaceholderImage = new UIImage("Images/default.png")
            });
            Grid.Columns.Add(new GridColumn {
                Binding = "Title", Header = "Title", MinWidth = 180, Width = GridLength.Star
            });
            Grid.Columns.Add(new GridColumn {
                Binding = "ChannelTitle", Header = "Channel"
            });
            Grid.GridLinesVisibility   = GridLinesVisibility.None;
            Grid.SelectionMode         = GridSelectionMode.None;
            Grid.ItemsSource           = _collectionView;
            Grid.CellTapped           += OnCellTapped;
            SearchField.Text           = "Xamarin iOS";
            SearchField.ShouldReturn   = new UITextFieldCondition(OnShouldReturn);
            SearchField.EditingDidEnd += OnEditingDidEnd;
            var task = PerformSearch();
        }
        private async void Load()
        {
            _collectionView = new YouTubeCollectionView()
            {
                PageSize = 25
            };
            var grouping = new C1GroupCollectionView <YouTubeVideo>(_collectionView, false);
            await grouping.GroupAsync("PublishedDay");

            grid.ItemsSource    = grouping;
            grid.MinColumnWidth = 85;
            search.Text         = "Xamarin.Forms";
            var task = PerformSearch();
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.OnDemand);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.OnDemandTitle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            Grid           = FindViewById <FlexGrid>(Resource.Id.Grid);
            Search         = FindViewById <EditText>(Resource.Id.Search);
            ProgressBar    = FindViewById <ProgressBar>(Resource.Id.ProgressBar);
            EmptyListLabel = FindViewById <TextView>(Resource.Id.EmptyListLabel);

            var dips_4   = TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, Resources.DisplayMetrics);
            var dips_70  = TypedValue.ApplyDimension(ComplexUnitType.Dip, 70, Resources.DisplayMetrics);
            var dips_100 = TypedValue.ApplyDimension(ComplexUnitType.Dip, 100, Resources.DisplayMetrics);
            var dips_160 = TypedValue.ApplyDimension(ComplexUnitType.Dip, 160, Resources.DisplayMetrics);

            CollectionView = new YouTubeCollectionView()
            {
                PageSize = 25
            };
            Grid.AutoGenerateColumns = false;
            Grid.Columns.Add(new GridImageColumn {
                Binding = "Thumbnail", Header = " ", Width = new GridLength(dips_70), ImagePadding = new C1Thickness(dips_4, dips_4, 0, dips_4), PlaceholderImageResource = Resource.Drawable.placeholder
            });
            Grid.Columns.Add(new GridColumn {
                Binding = "Title", Header = "Title", MinWidth = dips_160, Width = GridLength.Star
            });
            Grid.Columns.Add(new GridColumn {
                Binding = "ChannelTitle", Header = "Channel", Width = new GridLength(dips_100)
            });
            Grid.GridLinesVisibility = GridLinesVisibility.None;
            Grid.SelectionMode       = GridSelectionMode.None;
            Grid.ItemsSource         = CollectionView;
            Grid.CellTapped         += OnCellTapped;
            Search.Text          = "Xamarin Android";
            Search.EditorAction += OnEditorAction;
            var task = PerformSearch();
        }
        public OnDemand()
        {
            InitializeComponent();

            this.Title          = AppResources.OnDemandTitle;
            search.Placeholder  = AppResources.SearchPlaceholderText;
            emptyListLabel.Text = AppResources.EmptyListText;

            _collectionView = new YouTubeCollectionView()
            {
                PageSize = 25
            };
            grid.ItemsSource = _collectionView;
            orderBy.Items.Add("relevance");
            orderBy.Items.Add("date");
            orderBy.Items.Add("viewCount");
            orderBy.Items.Add("rating");
            orderBy.Items.Add("title");
            orderBy.SelectedIndex = 0;
            search.Text           = "Xamarin.Forms";
            var task = PerformSearch();
        }