Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Offscreen TapGestureRecognizer not firing

$
0
0

I've got a sliding drawer which contains an TapGestureRecognizer.

The set up is basically a relativelayout with two stacklayout children, one of which is positioned offscreen on load, like this:

var _relativeMaster = new RelativeLayout;

_relativeMaster.Children.Add(_stackDrawer,
Constraint.RelativeToParent(p => 0 - p.Bounds.Width * 0.92),
Constraint.Constant(0),
Constraint.RelativeToParent(p => p.Bounds.Width * 0.92),
Constraint.RelativeToParent(p => p.Bounds.Height));

_relativeMaster.Children.Add(_stackMain,
Constraint.Constant(0),
Constraint.Constant(0),
Constraint.RelativeToParent(p => p.Bounds.Width),
Constraint.RelativeToParent(p => p.Bounds.Height));

Visually the drawer behaves as expected, opening and closing via a TranslateTo animation, but any TapGestureRecognizers I add don't fire.

If I do not add the stackMain, and instead load the Drawer at (0,0) the events fire as I would expect. Is there something I need to do to get a TapGestureRecognizer attached to an element positioned offscreen to work?


Viewing all articles
Browse latest Browse all 58056

Trending Articles