Im stuck with how to make every grid unique when adding tap gesture recognizer! Is there another way to do it?
foreach (var item in list)
{
var grid = new Grid
{
BackgroundColor = Color.White,
Padding = 2,
HeightRequest = 150,
TranslationY = 5
};
grid.Children.Add(new Label
{
Text = item.Title,
FontSize = 16,
FontFamily="Arial",
TextColor = Color.Red,
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center,
HorizontalOptions =LayoutOptions.Center,
});
grid.Children.Add(new Label
{
Text = item.PublishTime.ToString(),
FontSize = 10,
FontFamily = "Arial",
TextColor = Color.Red,
VerticalTextAlignment = TextAlignment.Start,
HorizontalTextAlignment = TextAlignment.End,
TranslationX = -15,
});
grid.Children.Add(new Label
{
Text = item.Price.ToString() + " SEK",
FontSize = 16,
FontFamily = "Arial",
TextColor = Color.Red,
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.End,
TranslationX = -15,
WidthRequest = 90,
});
grid.Children.Add(new Image
{
Source = "item.jpg",
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Center,
WidthRequest = 120,
HeightRequest = 120,
``
});
PostList.Children.Add(grid);