Hiding the Navigation Bar in Xamarin Project using Mvvmcross

Published

I’m using mvvmcross and implementing the view’s interface in code behind. I would like to hide the navigation bar but I have not found a solution yet.

I tried

NavigationController.SetNavigationBarHidden(true, false);

and

NavigationController.NavigationBarHidden = true;

in different methods (ViewDidAppear and ViewWillAppear) but they don’t have an impact on the UI.

Maybe someone could give me a hint. 🙂

@Edit: Some more information:

My AppDelegate.cs

[Register("AppDelegate")]
public partial class AppDelegate : MvxApplicationDelegate
{
    UIWindow _window;

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        _window = new UIWindow(UIScreen.MainScreen.Bounds);

        var setup = new Setup(this, _window);
        setup.Initialize();

        var startup = Mvx.Resolve<IMvxAppStart>();
        startup.Start();

        _window.MakeKeyAndVisible();

        return true;
    }
}

Additionally I’m using a BaseView class which inherits from MvxViewController.

Source: Xamarin.ios Questions

Published
Categorised as Uncategorised Tagged , ,

Answers

Okay, found the solution by myself:

Just paste the following code into the ViewDidLoad method in your MvxViewController class( for example FirstView.cs in many mvvmcross tutorials):

var navController = base.NavigationController;
navController.NavigationBarHidden = true;

Maeve Ondricka DDS

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq