Xamarin Forms - Getting Rid of Back Button In Nav Bar

后端 未结 4 820
借酒劲吻你
借酒劲吻你 2020-12-14 15:43

Lets say the first page in the app is the login page and then it takes me to do the main menu screen, is there a way to get rid of the back button in the main menu navigatio

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 16:13

    By using CustomRenderer, you call this function in ViewWillAppear in your customized view controller

    public override void ViewWillAppear (bool animated)
    {
        base.ViewWillAppear (animated);
        this.ParentViewController.NavigationItem.SetHidesBackButton (true, false); 
        //remember to use ParentViewController to reference to the NavigationViewController (if your contentPage is direct under a navigation controller. I don't know why but Xamarin must have a bug with SetHidesBackButton. If you call with this.NavigationItem.SetHidesBackButton(...), it should not work. 
        ... other implements here ...
    }
    

提交回复
热议问题