public ProductsListTemplate(int countColumn, EventHandler clickProduct) { ClickProduct = clickProduct; IsCompleteShowGrid = true; CancelTSProduct = new CancellationTokenSource(); gridVerticalProductsList = new Grid { VerticalOptions = LayoutOptions.StartAndExpand, RowSpacing = 10, ColumnSpacing = 10, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) }, }, }; for (int i = 0; i < 10; i++) { gridVerticalProductsList.RowDefinitions.Add(new RowDefinition { Height = 210 }); } paginationBegin = new Pagination(); paginationEnd = new Pagination(); indicator = new ActivityIndicator { Color = Device.OnPlatform(Color.Black, Color.Gray, Color.Default), IsRunning = true, IsVisible = false, VerticalOptions = LayoutOptions.CenterAndExpand, }; layoutProductGrid = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(8, 8), Children = { paginationBegin, gridVerticalProductsList, paginationEnd }, IsVisible = false }; layoutMain = new StackLayout { //VerticalOptions = LayoutOptions.FillAndExpand, Children = { indicator, layoutProductGrid } }; VerticalOptions = LayoutOptions.FillAndExpand; Content = layoutMain; for (int i = 0; i < XPagination.CountProduct; i++) { ProductInCategoryTemplate productItem = new ProductInCategoryTemplate(); productItem.EventClick += ClickProduct; gridVerticalProductsList.Children.Add(productItem, i % countColumn, i / countColumn); } }