Flicker/delay happens while navigating to some other page on click of menu item in MasterDetail Page

Hi all,
I am using a Master detail Page in my xamarin forms project and its having a few items in slide out menu which opens some other page on their click event.
I am using the same approch which is given in xmarin site like :

public void PopulateSildeOutMenu()
{
string path = Helpers.Settings.getSettings ("ProfileImage");
if (String.IsNullOrEmpty (path)) {
path = "default.jpg";
}

        cand_dashboard_slideOutMenu_profileImage.FileSource = path;

        var slideOutMenuItems1 = new List<SlideOutMenuItem> ();
        slideOutMenuItems1.Add (new SlideOutMenuItem {
            Title = "Dashboard",
            IconSource = "dashboard.png",
            TargetType = typeof(DashboardHome)
        });
        slideOutMenuItems1.Add (new SlideOutMenuItem {
            Title = "Notifications",
            IconSource = "notifications.png",
            TargetType = typeof(DashboardHome)
        });
        slideOutMenuItems1.Add (new SlideOutMenuItem {
            Title = "My Profile",
            IconSource = "my_profile.png",
            TargetType = typeof(Profile)
        });

}

above code is in my slideout page and following in Masterdetail Page :

public partial class MasterDetail : MasterDetailPage
{

    public MasterDetail()
    {
        InitializeComponent ();
        NavigationPage.SetHasNavigationBar (this, false);
        slideOutMenu.ItemList1.ItemSelected += OnItemSelected;

    }


    async void OnItemSelected (object sender, SelectedItemChangedEventArgs e)
    {
        var item = e.SelectedItem as SlideOutMenuItem;
        if (item != null) {

                    Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
                    slideOutMenu.ItemList1.SelectedItem = null;
            IsPresented = false;
        }
    }
}

The above code works fine for me when I am navigating to other page in iOS but, same code creats a flicker/delay in opening next page while using in Android i.e. Page doesn't loads instantly. Any solution for that.. ?
Please suggest something, Thanks.

Answers

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @AmitKumar.8556 - Just to try and see if we can get an easy win, have you enabled Xaml Compilation on your device?

  • ArindamPalArindamPal USMember
    edited October 2016

    I am facing the same problem, uwp works ok, but there is a jarry experience for android. More the number of views in the page, more is the lag. It takes less than a second to load, but mars the experience. Will probably do better to reduce the number of view elements. Hoping this issue to be taken up in the subsequent xamarin form stable release.

    And xamlc is enabled on assembly level in our dev code.

  • testtest.2325testtest.2325 USMember

    @AdamP hi i m using XamlCompilation and facing the same issue. In fact removing that also make any effect.

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    There are a few things that could cause a flicker.

    First, it is best to set Animate = true when doing a PushAsync(). This allows an animated transition.

    Next, there will be an issue with a flicker, if you are changing the MainPage or if the MasterDetailPage is inside a navigation page. If you change a page inside a navigation page inside the Detail section of your MDP, then everything should run smoothly, as it's programmed to wait for the slideout menu to move to the side before it changes it's detail page.

    However if you are completely replacing the MDP, this doesn't happen, and you will get a flicker / bad experience as it tries to push the menu back in, while changing the page.

    The only alternative to that route, is to wait for approx 1 second, until the menu slides away, then change the page.

  • FonagerFonager DKMember ✭✭

    @AmitKumar.8556 - did you find any solution to this?

Sign In or Register to comment.