We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable the swipe gesture in SfNavigationDrawer

Platform: Xamarin.Forms |
Control: SfNavigationDrawer

Syncfusion NavigationDrawer in Xamarin provides SwipeGesture to make the drawer gets open when we swipe on the screen. When the SwipeGesture is disabled the user can use the ToggledDrawer method to open the NavigationDrawer.


To disable Swipe Gesture in NavigationDrawer follow the given procedures below.


Step 1: Create a sample of SNavigationDrawer and set EnableSwipeGesture to false so that it disables SwipeDesture.


The below code illustrates the way to achieve this.

XAML Code:

<navigation:SfNavigationDrawer x:Name="navigationDrawer"  EnableSwipeGesture="false" Position="Left" Transition="Push" TouchThreshold="30" DrawerHeight="100" DrawerWidth="120" DrawerHeaderHeight="100" DrawerFooterHeight="100"><!--    Set EnableSwipeGesture="True" to enable swipe gesture    --><navigation:SfNavigationDrawer.ContentView>  <StackLayout x:Name="ContentFrame" Orientation="Vertical">      <Button Text="Show Menu" Grid.Row="1"  BackgroundColor="#1aa1d6"  x:Name="Btnmenu" HorizontalOptions="Center" VerticalOptions="Center" ></Button>  </StackLayout></navigation:SfNavigationDrawer.ContentView><navigation:SfNavigationDrawer.DrawerHeaderView>  <Grid x:Name="headerLayout" BackgroundColor="#1aa1d6" >      <Label x:Name="header"  Text="Header View" FontSize="14" TextColor="White"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center"  />  </Grid></navigation:SfNavigationDrawer.DrawerHeaderView><navigation:SfNavigationDrawer.DrawerFooterView>  <Grid x:Name="footerLayout" BackgroundColor="#1aa1d6" >      <Label x:Name="footer"  Text="Footer View" FontSize="14" TextColor="White"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center"  />  </Grid></navigation:SfNavigationDrawer.DrawerFooterView>        <navigation:SfNavigationDrawer.DrawerContentView>  <Grid x:Name="drawerContent"  >      <Label x:Name="content"  Text="Drawer Content View" FontSize="14" TextColor="Black"  VerticalTextAlignment="Center" HorizontalTextAlignment="Center"  />  </Grid></navigation:SfNavigationDrawer.DrawerContentView></navigation:SfNavigationDrawer>  


C# Code:

namespace DrawerExample{    public partial class MainPage : ContentPage    {        public MainPage()        {            InitializeComponent();            Btnmenu.Clicked += (object sender, System.EventArgs e) =>            {                navigationDrawer.ToggleDrawer();            };        }    }} 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile