We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Crash if using list view with NavigationDrawer

Thread ID:





127360 Nov 10,2016 07:05 AM UTC Nov 11,2016 11:54 AM UTC Xamarin.Forms 1
Tags: SfNavigationDrawer
Long Ly
Asked On November 10, 2016 07:05 AM UTC

I run Xamarin Studio on Mac. I can also run SampleBrowser-Form project without any problem.
But when I try to write my own app using SfNavigationDrawer, the app always crash when it try to render NavigationDrawer. If I don't add ListView to DrawerContentView it will run fine.

My code:

    public partial class LogoutPage : ContentPage
        AuthenticationResult authenticationResult;

        public LogoutPage(AuthenticationResult result)
            authenticationResult = result;
            ObservableCollection<String> list = new ObservableCollection<string>();
            ListView listView = new ListView();
            listView.ItemsSource = list;

            var maincontent = new MainContentView_Default();
            StackLayout mainStack = new StackLayout();
            mainStack.Opacity = 1;
            mainStack.Orientation = StackOrientation.Vertical;
            mainStack.HeightRequest = 500;
            mainStack.BackgroundColor = Color.Black;
            //If I comment out below line, the app will run normal
            navigationDrawer.DrawerContentView = mainStack;
            navigationDrawer.ContentView = maincontent.Content;
            navigationDrawer.DrawerHeaderView = getDrawerheader();
            navigationDrawer.DrawerWidth = 200;
            navigationDrawer.DrawerHeaderHeight = 150;
            navigationDrawer.DrawerFooterHeight = 0;
            navigationDrawer.DrawerHeight = (float)App.ScreenHeight;
            navigationDrawer.Duration = 400;
            navigationDrawer.Position = Position.Left;
            navigationDrawer.Transition = Syncfusion.SfNavigationDrawer.XForms.Transition.SlideOnTop;
            navigationDrawer.TouchThreshold = 100;
        public View getDrawerheader()
            StackLayout headerLayout = new StackLayout();
            headerLayout.Orientation = StackOrientation.Vertical;
            headerLayout.BackgroundColor = Color.FromHex("#1aa1d6");
            headerLayout.VerticalOptions = LayoutOptions.CenterAndExpand;
            headerLayout.HorizontalOptions = LayoutOptions.CenterAndExpand;
            headerLayout.HeightRequest = 200;
            headerLayout.WidthRequest = 275;
            Image emp = new Image();
            emp.Source = ImageSource.FromFile("user.png");
            emp.HeightRequest = 100;
            emp.WidthRequest = 70;
            emp.HorizontalOptions = LayoutOptions.CenterAndExpand;
            emp.VerticalOptions = LayoutOptions.Center;
            emp.BackgroundColor = Color.FromHex("#1aa1d6");

            Label header = new Label();
            header.Text = "James Pollock";
            header.FontSize = 20;
            header.HeightRequest = 30;
            header.WidthRequest = 140;
            header.TextColor = Color.White;
            header.HorizontalOptions = LayoutOptions.Center;
            header.VerticalOptions = LayoutOptions.Center;
            header.BackgroundColor = Color.FromHex("#1aa1d6");
            return headerLayout;

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:navigation="clr-namespace:Syncfusion.SfNavigationDrawer.XForms;assembly=Syncfusion.SfNavigationDrawer.XForms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ADB2CAuthorization.LogoutPage" Title="Logout">
    <navigation:SfNavigationDrawer BackgroundColor="White" x:Name="navigationDrawer" >

 Please advice me how to avoid the crash. Thank you.

Attachment: Screen_Shot_20161110_at_1.45.44_PM_97af304e.zip

Pavendhan Kumar [Syncfusion]
Replied On November 11, 2016 11:54 AM UTC

Hi Long,

We would like to inform that the issue "Adding list view in NavigationDrawer’s throws exception" is occurring due to Xamarin Forms latest version (i.e. We request you to use the older version (i.e. of Xamarin forms till the has been resolved. And also there is a query already raised in Xamarin forum regarding the same. Please find the link for the query.


And We have filed a bug report about "adding a list view in NavigationDrawer crashes the app on Xamarin.Forms Android platform" and please find the link for the report

Link: https://bugzilla.xamarin.com/show_bug.cgi?id=46563 

Pavendhan K. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon