Properly use UI Buttons

Hello everyone,
i’m just trying to catch the event “ispressed” from a button child of a canvas.
i tried:
var buttonExit = main.Page.RootElement.FindVisualChildOfType<Panel>("CanMain").FindVisualChildOfType<Button>("ButtonExit");
But nothing happened.

Fixed it by myself because of my mistake.

I had 2 canvas with the same behaviour, the one without script was behind the other.
So, i couldn’t call the method because of a button behind the true one.

Feel free to close or delete this post.