I have a simple Stacklayout
that shows Buttons.
I want to be able to let children remove itself from the stacklayout
.
this project is just for testing purposes, so every button is linked to the same event-handler.
private void Button_Pressed_1(object sender, EventArgs e)
{
stack.Children.RemoveAt(stack.Children.Count - 1);
}
everything's fine until one button removes itself, then the following unsupported error appears:
Unhandled Exception:
System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer from native handle 0xbfb79bfc (key_handle 0x3e59524).
Has anyone an idea how to accomplish this? Since it's a nonSupportedException
a simple try & catch didn't do the job
EDIT: I got it working, i registered the eventhandler to the Pressed-Event. Appearently that was the problem, when using the Clicke-Event everything works just fine.