LittleFunny
LittleFunny

Reputation: 8385

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

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.

Upvotes: 6

Views: 6351

Answers (3)

testing
testing

Reputation: 20279

On MasterDetailPage you add this:

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

    if (Device.RuntimePlatform == Device.iOS)
    {
        IsGestureEnabled = false;
    }
}

Upvotes: 3

user2964251
user2964251

Reputation: 51

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

#if __IOS__
IsGestureEnabled = false
#endif

Upvotes: 3

LittleFunny
LittleFunny

Reputation: 8385

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.

Upvotes: 11

Related Questions