SideDrawer stays empty

9 posts, 0 answers
  1. Julian
    Julian avatar
    6 posts
    Member since:
    Aug 2015

    Posted 08 Jul Link to this post

    Hello guys,

    I am facing a confusing error with the SideDrawer control in my Xamarin Forms application. I am using the current nuget version of the control.
    In my application I am setting the Content of the sidedrawer in C# like this:

    Class 1:

         InitializeComponent();
         Drawer.DrawerContent = App.ConnectService.SideDrawer ;


    This works great, but I am running into a problem when I navigate to another Page.
    The problem appears when I popback to Class 1 without opening the SideDrawer on the Pushed Page. In this case the Sidedrawer stays white.
    In the debugger, I can see that the drawer content is still set. So setting Drawer.DrawerContent = App.ConnectService.SideDrawer; again doesn’t change anything

    When I open the SideDrawer on the pushed Page once, I don’t run into this strange effect.

    Best regards

    Julian

  2. Julian
    Julian avatar
    6 posts
    Member since:
    Aug 2015

    Posted 11 Jul Link to this post

    Just a short update.

    If I call:

        Drawer.DrawerContent = null;

        Drawer.DrawerContent = App.ConnectService.SideDrawer ;

    the view is visible again.

    Best regards

    Julian

  3. DevCraft banner
  4. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 13 Jul Link to this post

    Hi Julian,

    I have attached a small example, which seems to work fine for me. Can you please modify it, so that it matches your scenario and the issue is reproduced. This way we will be able to review it locally and get back to you with our findings.

    Best regards,
    Ves
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Julian
    Julian avatar
    6 posts
    Member since:
    Aug 2015

    Posted 23 Sep Link to this post

    Hey guys, I've created a little Xamarin-forms example project to present the problem to you.

    How to reproduce the problem: 
    1: Open the Sidedrawer on the left side.
    2: Navigate to another page over the Sidedrawer.

    On Android everything is working fine until now, but on iOS the Sidedrawer stays empty. Even if you navigate back to Page1 this Drawer is empty too.

    Since my navigationmenu is huge in my app I don't want to create multiple instances. I would like to share a single instance through the entire app. 

    Best regards
    Julian
  6. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 28 Sep Link to this post

    Hi Julian,

    Thanks for the project. I have edited your message to remove the link, as it contains Telerik assemblies. As for the problem -- I can confirm that I can see improper behavior. It will take a while to debug it. I will write back as soon as I have more information.

    Best regards,
    Ves
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Julian
    Julian avatar
    6 posts
    Member since:
    Aug 2015

    Posted 28 Sep Link to this post

    Hi Ves,

    I am sorry for posting a Link containing your assemblies. 
    Thanks in advance for your help.

     

    Best regards ,

    Julian

  8. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 29 Sep Link to this post

    Hi Julian,

    Here are some more details. Swiping from left after navigation does not really open the new page's SideDrawer. This gesture actually navigates back to Page1. Now, for some reason Page1 is not restored correctly, so the SideDrawer appears empty. This is easily worked around -- move the code that sets DrawerContent in OnAppearing method, but first set it to null:

    protected override void OnAppearing()
            {
                base.OnAppearing();
                Drawer.DrawerContent = null;
                Drawer.DrawerContent = App.ConnectService.Menu;
            }

    With this change the app would work like this: on swipe from left, the app navigates back to Page1 with the SideDrawer already open and populated. Using navigation with SideDrawer in each page is not supported in Xamarin.Forms. The problem is in the NavigationController, which gets the gesture, hence SideDrawer of Page2 and Page3 is never open. Setting navigation controller's InteractivePopGestureRecognizer.Enabled to false disallows the swipe altogether. The same problem is discussed and solved in Xamarin.iOS in the following article:
    http://docs.telerik.com/devtools/ios/sidedrawer/sidedrawer-with-uinavigationcontroller

    Best regards,
    Ves
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Julian
    Julian avatar
    6 posts
    Member since:
    Aug 2015

    Posted 29 Sep Link to this post

    Hey Ves, 

    I am using InteractivePopGestureRecognizer.Enabled = false already in my application. 

    So am I right in my findings that I'll have to use an onAppearing event on every Page to solve my problem?

    Best regards

    Julian

  10. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 04 Oct Link to this post

    Hi Julian,

    There is a RaSideDrawer on every page. Whether it is populated in the page constructor or in OnAppearing is not much of a difference, as long as it serves the purpose.

    Frankly, in this case, I was not able to swipe from right, so I am a bit curious what's your setup (if different from the sample you already provided)

    Best regards,
    Ves
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner