locked
SwipeGestureRecognizer also enable MasterDetailPage Navigation Drawer? RRS feed

  • Question

  • User351573 posted

    I have implemented the swiping feature using SwipeGestureRecognizer on my homepage. But the problem is the home page is a child of a MasterDetailPage. So when I swipe to left in the homepage, the navigation drawer is also coming to UI. I have tried like below to stop showing navigation drawer on UI when doing SwipeGestureRecognizer using MessagingCenter, but no luck!!!

    On Homepage

    public void Swipe(object sender, EventArgs e)
    {
        MessagingCenter.Send<HomePage>(this, "HomePageSwipe");
        //code for swipe
    }
    

    On MasterDetailPage Constructor

    MessagingCenter.Subscribe<HomePage1>(this, "HomePageSwipe", (sender) =>
    {
        IsPresented = false;
        NavigationPage.SetHasNavigationBar(this, false);
    });
    

    Is there any way to fix this?

    Friday, December 13, 2019 5:00 AM

Answers

  • User185808 posted

    I believe this behavior occurs only on ios. To disable this, you need to add this to the OnAppearing() method

    if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS)
    {
        IsGestureEnabled = false;
    }
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, December 13, 2019 6:40 AM