Map in master detail stops swipe to open.

simeonsimeon USMember ✭✭
edited June 2014 in Xamarin.Forms

My app design wraps a few pages in a navigation page to load into the details page of a master detail view. So far this works really nice. I get a button on the navigation header that lets me open the master menu and I can forward navigate into new pages for the different parts of my app. The menu opens on the main page with a swipe but as soon as I navigate to a page with a map on the swipe to open gesture stops working. I appreciate that I cant really swipe on the map page as the map takes up the full screen but even after I have changed page the swipe to open never comes back.

I done a nuget to get version 1.1.1 before I started so I am not sure if it used to work? Or if what I am doing is supported. I have made a small sample that demonstrates this issue

public class App
{
    public static Page GetMainPage()
    {
        ContentPage content = new ContentPage { Title = "Map" };
        //As soon as you add this the swipe gesture stops working.
      //  content.Content = new Map { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand };
        content.Content = new Label { Text = "This works.", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand };
        NavigationPage navigationPage = new NavigationPage(content);

        return new MasterDetailPage
        {
            Title = "Map Example",
            Master = new ContentPage { Title = "Menu" },
            Detail = navigationPage
        };
    }
}

Cheers,

Simeon

Posts

  • MarshallMarshall USMember ✭✭

    the was I always used the map with the MasterDetailPage is to just use a button that takes care of presenting. this is because the map kind of screws with the MasterDetailPage for some reason.

  • simeonsimeon USMember ✭✭

    @Marshall‌

    Cheers man it's good that someone else has the same issue I suppose as it shows I have not down it wrong!

    Hopefully the issue can be resolved.

  • BoonCheongBoonCheong GBMember

    I have exactly the same problem. Would appreciate a solution please.

  • simeonsimeon USMember ✭✭

    Just back on this. It only fails on iOS, when I am testing the same app on Android the swipe gesture is available from the edge even with the map loaded as the page in the detail section. The IsGestureEnabled property on the master detail form is always set to true. I thought I might of been able to control the swipe gesture with this property.

  • BoonCheongBoonCheong GBMember

    I tried playing with the IsGestureEnabled property. No, it did not work.

    I also implemented an event handler for the IsPresentedChanged event on the MasterDetailPage. After debugging the code, I found that the IsGestureEnabled was set correctly even after showing a page with a Map object. Therefore, there must be a bug with Xamarin.Forms.

    Could the Xamarin team look into this please.

  • ClaudioSanchezClaudioSanchez USUniversity, Developer Group Leader ✭✭

    I am experiencing the same issue described above where the swipe gesture stops working as soon as you enter a page with a map in it.

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I see the same in my test app; not sure if there's a bug already raised or not. Will look.

  • simeonsimeon USMember ✭✭

    I ended up subclassing Xamarin.Forms.Platform.iOS.PhoneMasterDetailRenderer and writing my own delegate for the UIPanGestureRecognizer as the map seems to corrupt the detail controllers view frame x value.

    If you record your own x value and test it in the UIPanGestureRecognizer.Ended state, you can control the presented state.

  • simeonsimeon USMember ✭✭

    Got permission to post my companies code. So take a look at my dirty hack....

  • Not only is the swipe not effective, after adding @simeon's workaround it still won't trigger a repaint after changing the Frame in the case of UIGestureRecognizerState.Changed.

    I'm experiencing the same thing. I don't have the time, but did you verify this also occurs in the CRM sample app? That one has a map in a MDP too right?

    Or did you guys figure this out already?

  • simeonsimeon USMember ✭✭

    I still have my hack in place not sure if @CraigDunn‌ raised a bug or not?

  • CraigDunnCraigDunn USXamarin Team Xamurai

    Yep it's a known issue, thanks @simeon‌

  • NunoFonsecaNunoFonseca PTMember
    edited September 2014

    Is there a already a solution to this problem? I think i have the opposite problem, when i swipe left-to-right on the map, the master page (menu) is always shown, and the map stays still.

  • ilinazailinaza USMember

    Any news on this?

    I have the same issue as @NunoFonseca. When master is not presented, left to right gesture over the map displays the master page, and when master is presented, the opposite gesture hides it. Any other swipe directions trigger pan on the map.

  • HoaiLeHoaiLe VNMember ✭✭

    Any news on this?
    I get same problem!

  • HugoDantasHugoDantas USMember

    I'm with this same error but I verified one thing: This error only occurs on iPad (Any iOS version). On iPhone or Android it moves the map correctly.

    If I have one Map in any children of a DetailPage in a MasterDetailPage, when I swipe to right, the Menu is opened instead of move map region.

    This is my structure:

    MasterDetailPage
    > DetailPage: TabbedPage
    > SecondTab: Map
    
Sign In or Register to comment.