Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Sliding a content view over a stacklayout

$
0
0

Hi,

I have a stack layout on my content page. Part of the content page calls a custom navigation bar which has a burger menu on it on the right. When the burger is clicked, an instance of a ContentView is created (called in the code) menu. The idea is that this then pushes the menu over the existing stack layout.

My code currently looks like this

menu = new MenuView();
                var gestRight = new TapGestureRecognizer
                {
                    NumberOfTapsRequired = 1,
                    Command = new Command((o) =>
                        {
                            if (!App.Self.PanelShowing)
                            {
                                Device.BeginInvokeOnMainThread(async() =>
                                    {
                                        await menu.Content.LayoutTo(currentPage.Bounds, 250, Easing.CubicOut);
                                        await panel.LayoutTo(panel.Bounds, 250, Easing.CubicIn);
                                        menu.IsVisible = true;
                                        panel.RaiseChild(menu);
                                        App.Self.PanelShowing = true;
                                    });
                            }
                            else
                            {
                                App.Self.PanelShowing = false;
                            }
                        })
                };

I've tried a number of permutation of this code, but the menu doesn't show. A breakpoint within the BeginInvoke is being hit and none of the values are null.

panel is the stack layout on the main UI passed into the top bar instance. currentPage is the ContentPage the bar is called from.

Any ideas?

PFJ


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>