Swipe Gesture in .NET MAUI Navigation Drawer (SfNavigationDrawer)
29 Jul 20262 minutes to read
The .NET MAUI Navigation Drawer supports a swipe gesture for both opening and closing the side pane. The gesture is enabled by default and can be customized to fit the layout of your app.
Prerequisites
Before using the SfNavigationDrawer, ensure the following NuGet package is installed in your .NET MAUI project:
Syncfusion.Maui.NavigationDrawer
For step-by-step setup, refer to the Getting Started documentation.
Enable swipe gesture
Use EnableSwipeGesture to enable or disable the swipe gesture. When set to false, the user can still open or close the side pane programmatically via IsOpen or ToggleDrawer or by tapping a hamburger button.
<navigationDrawer:SfNavigationDrawer x:Name="navigationDrawer">
<navigationDrawer:SfNavigationDrawer.DrawerSettings>
<navigationDrawer:DrawerSettings EnableSwipeGesture="True" />
</navigationDrawer:SfNavigationDrawer.DrawerSettings>
</navigationDrawer:SfNavigationDrawer>SfNavigationDrawer navigationDrawer = new SfNavigationDrawer()
{
DrawerSettings = new DrawerSettings
{
EnableSwipeGesture = true
},
};Swipe sensitivity
Use TouchThreshold to control the size of the swipe region measured from the drawer’s edge. The default is 120.
<navigationDrawer:SfNavigationDrawer x:Name="navigationDrawer">
<navigationDrawer:SfNavigationDrawer.DrawerSettings>
<navigationDrawer:DrawerSettings TouchThreshold="200" />
</navigationDrawer:SfNavigationDrawer.DrawerSettings>
</navigationDrawer:SfNavigationDrawer>SfNavigationDrawer navigationDrawer = new SfNavigationDrawer()
{
DrawerSettings = new DrawerSettings
{
TouchThreshold = 200
},
};