Problem with Xamarin.Forms and SlideOverKit

I’m trying to use the SlideOverKit from NuGet and am having a slight issue. I can get the menu to show and have it configured the way I want it. I am trying to open a new page from the menu and am having issues getting it to view. I know that the view is initializing with the logging I have in the code behind it just doesn’t show on screen.

I have a grid of labels each as a GestureRecognizer on it and I pass that on to another method OnClick() that has a switch in it and I am getting text of the label and then firing my code to open the new view and I see the logging but never see the view. I’m using Navigation.PushModalAsync(new ServicePage()) to call the page.

I’m sure I’m missing something simple in the setup of the SlideOverKit, I’m relatively new to Xamarin as well which isn’t helping the situation. I'm using Navigation.PushModelAsync and PushModal in a couple of other places with no issues in presenting the new view. I can add a button to the Parent View containing the menu and push the view on screen without any issue it just seems to be an issue when I try and present it from the SlideOverKit Menu.

I’ve attached my code behind for the MenuView so you can see if I’m missing something there. I appreciate the help.

`namespace Spiffy
{
public partial class MenuView : SlideMenuView
{
public Action NavigationPage { get; set; }

    bool debug = true;

    public MenuView ()
    {
        InitializeComponent ();

    }

    public MenuView (MenuOrientation orientation) : this ()
    {

        //Gesture Recognizer
        var tgr = new TapGestureRecognizer ();
        tgr.Tapped += (sender, e) => 
        {
            var labelSender = (Label)sender;
            OnClick (labelSender.Text);
        };

        //Add GestureRecognizer on all the labels
        menuServices.GestureRecognizers.Add (tgr);
        contactUs.GestureRecognizers.Add (tgr);
        giftCard.GestureRecognizers.Add (tgr);
        scheduleService.GestureRecognizers.Add (tgr);
        updateLocations.GestureRecognizers.Add (tgr);
        updateVehicles.GestureRecognizers.Add (tgr);
        faqs.GestureRecognizers.Add (tgr);
        profile.GestureRecognizers.Add (tgr);
        logout.GestureRecognizers.Add (tgr);

        //Slide out menu setup
        this.MenuOrientations = orientation;
        this.BackgroundColor = Color.Black;
        this.BackgroundViewColor = Color.Transparent;

        // Horizontal Menu
        if (this.MenuOrientations == MenuOrientation.LeftToRight) {

            // Horizaontal menu only need topMargin
            // Full size Menu 
            this.TopMargin = 0;
            this.IsFullScreen = true;           
            this.DraggerButtonWidth = 0;
        }
    }

    void OnClick(string labelClicked)
    {
        switch(labelClicked)
        {
        case "Menu of Services":
            this.HideWithoutAnimations ();
            Navigation.PushModalAsync (new ServicesPage());

            break;
        case "Contact Us":
            break;
        case "Send an eGift Card":
            break;
        case "Schedule Service":
            break;
        case "Update locations":
            break;
        case "Update Vehicles":
            break;
        case "FAQ's":
            break;
        case "Profile":
            break;
        case "Logout":
            break;
        default:
            break;
        };
        if (debug)
        {
            SpiffyCore.SpiffyLog ("Label Clicked: " + labelClicked);    
        }

    }

}

}`

Best Answer

Answers

  • KevinCraig.3353KevinCraig.3353 USMember ✭✭

    Ah okay, that makes sense. I will setup the message center and give that a try. I'll also check out FreshMvvm for sure.

    I'll let you know as soon as I have a chance to work on it in the morning. Thanks for the help. I knew it was something simple I wasn't doing right I just couldn't see it.

  • CostasAletrariCostasAletrari USMember ✭✭

    Hello @KevinCraig.3353 did you manage to get this working with the message center? would you have a small example? Im just about to go study up on the message center, any form of tips much appreciated. thanks

Sign In or Register to comment.