This is a migrated thread and some comments may be shown as answers.

Multiple Drawers?

2 Answers 118 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Kevin asked on 22 Oct 2015, 06:47 PM

Trying to get a little tricky here, to see what I can and can't do.  I have the following in my App.cs in my Xamarin.Forms project:


            BindingContext = new MainViewModel();

            RadSideDrawer rsd = new RadSideDrawer();
            rsd.DrawerLength = 250;

            RadPieChart pie = new RadPieChart();

            PieSeries series = new PieSeries();
            series.SetBinding( BarSeries.ItemsSourceProperty, new Binding( "Data" ) );
            series.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };

            pie.Series.Add( series );

            RadSideDrawer rightDrawer = new RadSideDrawer();

            StackLayout slr = new StackLayout();
            slr.Padding = 20;
            slr.Children.Add( new Label() { Text = "Right Side" } );
            slr.Children.Add( new Button() { Text = "​R One" } );
            slr.Children.Add( new Button() { Text = "​R Two" } );
            slr.Children.Add( new Button() { Text = "​R Three" } );
            slr.Children.Add( new Button() { Text = "​R Four" } );
            rightDrawer.DrawerContent = slr;
            rightDrawer.DrawerLocation = Telerik.XamarinForms.Primitives.SideDrawer.SideDrawerLocation.Right;
            rightDrawer.MainContent = pie;

            rsd.MainContent = rightDrawer;

            StackLayout sl = new StackLayout();
            sl.Padding = 20;
            sl.Children.Add( new Label() { Text = "Left Side" } );
            sl.Children.Add( new Button() { Text = "​L One" } );
            sl.Children.Add( new Button() { Text = "​L Two" } );
            sl.Children.Add( new Button() { Text = "​L Three" } );
            sl.Children.Add( new Button() { Text = "L Four" } );

            rsd.DrawerContent = sl;

            // The root page of your application
            ContentPage p = new ContentPage();
            p.BackgroundColor = Xamarin.Forms.Device.OnPlatform( Xamarin.Forms.Color.White, Xamarin.Forms.Color.White, Xamarin.Forms.Color.Transparent );

            p.Content = rsd;

            MainPage = p;

Ignoring the ViewModel and PieChart data, the Pie Chart here doesn't render.  If I remove one of the Drawers, and set the remaining drawer's MainContent to the pie chart, it works. But the embedded drawers here prevent the chart from rendering.

 Is there a way to make this work?


2 Answers, 1 is accepted

Sort by
Pavel R. Pavlov
Telerik team
answered on 27 Oct 2015, 02:33 PM
Hi Kevin,

Thank you for contacting us. The provided code was really helpful in reproducing your scenario on our side. We confirm that the reported issue exist in our latest official release. This is why I logged it in our system and I will make sure it reaches the respective developer. Also, I updated your Telerik points.

As for the issue itself, it seems that the BindingContext of the MainContent of the inner RadSideDrawer does not propagate (to the outer one) as expected. This is why you can try setting the BindingContext property to the RadPieChart directly. 

I hope you will be able to use this workaround in your real live app. Please do not hesitate to contact us again if you encounter any other issues.

Pavel R. Pavlov
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
Top achievements
Rank 1
answered on 27 Oct 2015, 06:09 PM

That did the trick!  Thanks, Pavel!



Asked by
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Top achievements
Rank 1
Share this question