Обращение к дочерному объекту из дочерного объекта
У меня есть StackLayout в котором храниться ImageButton,Label, и еще один StackLayout в котором еще 2 Label, надо чтобы при нажатии на ImageButton, я мог в string a присвоить текст из Label который находится в основном StackLayout
<StackLayout Grid.Row="0">
<Image BackgroundColor="White" HeightRequest="150" Margin="0,-18,0,0" Source="https://cdn.sushiwok.ru/img/a6ca1d32cffce82567a213237e1bb9da/350x350"></Image>
<Label Margin="0,-18,0,0" FontFamily="Lobster" FontSize="20" HorizontalTextAlignment="Center" TextColor="Black">Суши Острый Угорь 2 шт</Label>
<StackLayout Orientation="Horizontal">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="OnTapped"/>
</StackLayout.GestureRecognizers>
<StackLayout>
<Label Margin="5,-15,0,0" TextColor="Red" FontAttributes="Bold" FontSize="25">199 р.</Label>
<Label Margin="5,-10,0,0" TextColor="LightGray" FontSize="20">̶2̶5̶0̶ ̶р̶.̶</Label>
</StackLayout>
<ImageButton Clicked="Buy_Clicked_2" Margin="20,0,0,0" Source="https://media.discordapp.net/attachments/770722183957577789/952982843158581288/free-icon-bags-6997133.png" BackgroundColor="White"></ImageButton>
</StackLayout>
</StackLayout>
Я пробывал вот этот метод:
foreach (var child in ((sender as ImageButton).Parent as StackLayout).Children)
{
if (child is Label)
{
child.IsEnabled = false;
}
}