PointerDown in a Container

Just wondering if anybody has noticed the same behavior. Hope I can explain it properly.

I’d like to have a button with a background color and when the user taps it, the background color should change and come back to the original color as soon as the user releases it. So what I do is create a label, a rectangle and a canvas.

My code in the PointerDown event of the canvas looks like this (my variables starting with cgr indicate color groups):

Rectangle1.FillColor = cgrWhite

In the PointerUp event it’s this:

Rectange1.FillColor = cgrYellow

So far so good. I put these three controls on a view it works perfectly. When I put the controls in a container control which I then put in a scrollable area - or I put the controls in a custom table cell which I put in a table -, it works too, just with a bit of delay. And that’s my problem. It’s only a visual problem but I’d like to get the user this visual feedback.

So, to summarize: my button is on a view, user taps it, background color changes and then the screen changes. My button is in a scrollable area or in a table, user taps it, the screen changes before the color does. Any way to get the same behavior on the user tap?

The native solution is to use Declares


For more styling features I highly recommend using iOSDesignExtensions

Thank you, Jeremie. Now if you tell me I can have rounded corners on the button with DesignExtensions, that would be the cherry. I haven’t found it yet. SetCornerRadiusXC doesn’t work somehow.

Yes SetCornerRadiusXC is the way to have rounded corners.

But it might not be compatible with the code I sent previously. I’ll check

I figured it out! There’s “SetCornerRadiusXC” code in the ButtonExtensions which doesn’t work but the code in ControlExtensions - which is for labels - works when I modify it for buttons. A-W-E-S-O-M-E! Thank you very much, Jeremie!

I was too quick. It works in the Simulator but not on the actual device…