Xamarin Forms Button Clicked Event seems to be firing twice

ChrisMason.2517ChrisMason.2517 USMember, University ✭✭

Hi: I'm trying to press a button in a tictactoe game I wrote.
It seems like the debugger is showing me the Clicked handler method is being called twice.
Is this how its supposed to be? Should I check the eventargs to decide which kind of click it is?
Does clicked event handler get called twice usually?
Button ticButtonUpperMiddle = new Button
{
Text = "UM"
};
ticButtonUpperMiddle.Clicked += OnTicButtonUpperMiddleClicked;

So I find the below method gets called twice? I'm adding the method in the constructor of the page.

void OnTicButtonUpperMiddleClicked(object sender, EventArgs e)
{
int square = 2;
GameButtonPressedLogic(sender, square);
}

Posts

  • ChrisMason.2517ChrisMason.2517 USMember, University ✭✭

    Nevermind..I get this behavior if i use a mouse..but if i press the screen it doesn't fire twice...
    sorry...I guess the mouse click sends the clicked event twice somehow..

Sign In or Register to comment.