I am working on xamarin.forms application and I have question that I could not solve.
1) I have multiple Grid
s one after another that contain button, label and image. Now, on button click I want to change image or rotate it to down. But somehow, I am not able to do it.
My first try was to get parent of button and find image using FindByName
method. But FindByName
returns null, but I can see grid in parent while debugging.
My second try was to get row of button and find all the controls that are in that row. Because my image is in the same row as button.
My structure is something like this
My grid works fine but only rotation issue is there.
pubic void OnButtonClicked(object sender, EventArgs e)
{
var SenderButton = (Button)sender;
var row = Grid.GetRow(SenderButton); // Here i get row = 0 but dont know how to find other controls on same row.
Image upimage = SenderButton.Parent.FindByName<Image>("imageExpand"); // imageExpand is my image name in grid.
upimage.Source = "upimage.png";
}
Here upimage
is null
.
Thank you very much.
XAML
code?