Forum Xamarin.Forms

How can I hook up a button click to a swipe gesture?

I have an app using a master detail page and a navigation page within it, on Android when you navigate via the burger menu the nav bar stays at the top of the screen as expected so you can navigate using it. On iOS the nav bar doesn't stay there, so I've created a custom bar with a burger menu icon. When someone clicks the burger icon I want the burger menu to swipe out from the left.

I've attached a gesture recogniser to the burger icon but I don't know what to put in the called method to make it perform the swipe action.

Nav bar on second page:
<StackLayout IsVisible="{Binding _isiPhone}" Orientation="Horizontal" BackgroundColor="#008334"> <Image Source="burger.png" HorizontalOptions="StartAndExpand"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="Burger_Clicked"></TapGestureRecognizer> </Image.GestureRecognizers> </Image> </StackLayout>

Event handler;
private void Burger_Clicked(object sender, EventArgs e) { }

Please see attached images for burger menu view an Android view.

Best Answer


Sign In or Register to comment.