Xamarin Form : Master Detail Page : How to disable swipe gesture to load the menu on iOS
Asked Answered
I

3

6

I need the screen to draw stuff on it. Since I have a Master Detail Page on the same screen, whenever I draw in a direction as opening the menu, the menu will swipe open at the same time as I draw.

Is there a way to stop it from swipe open, but still have the menu button clickable to open it.

Impiety answered 9/11, 2016 at 21:1 Comment(0)
I
11

I found the solution:

#if __IOS__
    IsGestureEnabled = false
#endif

Setting Is GestureEnabled to false will stop from the menu being swiped open. This value only can be set for iOS. If I set for android, the menu button will not open the menu when clicked.

Impiety answered 9/11, 2016 at 23:4 Comment(3)
You can mark your reply as an answer - there's nothing wrong in such practice and this will definitely help othersCanebrake
Ever figure out a solution for Android to accomplish this? Seems silly this isn't easy.Ballet
Does anyone know a way to do the same effect on xamarin android as well?Catwalk
B
3

For this, you need to write IsPresented = true along with

#if __IOS__
IsGestureEnabled = false
#endif
Basra answered 28/5, 2017 at 2:10 Comment(0)
M
3

On MasterDetailPage you add this:

protected override void OnAppearing()
{
    base.OnAppearing();

    if (Device.RuntimePlatform == Device.iOS)
    {
        IsGestureEnabled = false;
    }
}
Mushro answered 19/6, 2019 at 12:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.