Im using a stacklayout that contains some other elements and a button.
<StackLayout x:Name="layout">
<Button Text="Button" Clicked="Action"/>
<StackLayout/>
Is there a way to get the StackLayout that contains the button when it is clicked?
Use Parent property
void Action(object sender, EventArgs args)
{
var button = sender as Button;
var stackLayout = button.Parent as StackLayout;
stackLayout.Children.Remove(button);
}