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

            _dataCollection = new YouTubeDataCollection()
            {
                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           = _dataCollection;
            Grid.CellTapped           += OnCellTapped;
            SearchField.Text           = "Xamarin iOS";
            SearchField.ShouldReturn   = new UITextFieldCondition(OnShouldReturn);
            SearchField.EditingDidEnd += OnEditingDidEnd;
            _ = PerformSearch();
        }
Esempio n. 2
0
        private async void Load()
        {
            _dataCollection = new YouTubeDataCollection()
            {
                PageSize = 25
            };
            var grouping = new C1GroupDataCollection <YouTubeVideo>(_dataCollection, 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);

            DataCollection = new YouTubeDataCollection()
            {
                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         = DataCollection;
            Grid.CellTapped         += OnCellTapped;
            Search.Text          = "Xamarin Android";
            Search.EditorAction += OnEditorAction;
            var task = PerformSearch();
        }