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

こ雲淡風輕ζ 提交于 2020-07-30 05:23:50

问题


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.


回答1:


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.




回答2:


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

#if __IOS__
IsGestureEnabled = false
#endif



回答3:


On MasterDetailPage you add this:

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

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


来源:https://stackoverflow.com/questions/40515952/xamarin-form-master-detail-page-how-to-disable-swipe-gesture-to-load-the-men

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!