Hi all,
I know it sounds i little bit strange, but maybe i am doing something wrong on my code.
I am developing a ContentPage containing a grid, inside this grid i dynamically add a button with an event, like the code below:
`List<Model.Style> obj = new List<Model.Style>();
Task.Run(async () =>
{
obj = await RefreshDataAsync();
}).Wait();
int intRow = 0;
int intColumn = 1;
foreach (var item in obj)
{
var navButton = new CustomButtonGradient
{
Text = item.Description,
TextColor = Color.White,
//FontFamily = Fonts.SFUiText,
FontAttributes = FontAttributes.Bold,
FontSize = 14,//Device.GetNamedSize(NamedSize.Small, typeof(CustomButtonGradient)),
Image = "black_check_icon.png",
//BackgroundStartColor = Color.FromHex("D96B57"),
//BackgroundEndColor = Color.FromHex("D6523A"),
BackgroundColor = Color.Red,
BorderRadius = 11,
HeightRequest = 32,
WidthRequest = 86,
VerticalOptions = LayoutOptions.Center,
//Margin = new Thickness(1, 0, 1, 0),
//CommandParameter = item
};
navButton.Clicked += MyButton_Clicked;
if(intColumn%4==0)
{
intColumn = 1;
intRow += 1;
}
gvMain.Children.Add(navButton,intColumn,intRow);
intColumn += 1;
}`
So, when i run this code on my iphone simulator, the button event works only on first column of each grid row. On the another columns, when button is clicked, nothing is raised.
Is there something wrong or is there anything i can do to workaround this issue?