CustomNavigationBarSample icon indicating copy to clipboard operation
CustomNavigationBarSample copied to clipboard

How to add it to TabbedPage

Open bluekuen opened this issue 6 years ago • 3 comments

Hello,

i love your navigation bar but i need it in a TabbedPage. Can you give me a hint how to do this because i can't get it done.

Looking forward for your answer bluekuen

bluekuen avatar Apr 25 '18 06:04 bluekuen

Bump. LOVE THIS but having the same problem in iOS (works fine for me in Android).

When implementing this in a TabbedPage, the ViewWillAppear has a null NavigationController in CustomNavigationBarSample.iOS.Renderers.CustomPageRenderer. I think it has something to do with the way iOS has separate UINavigationControllers inside of each tab of UITabBarController.

It would be really awesome to have this sorted out. I was determined to hunt it down but ran out of time under a tight deadline so I'm using this for Android but just using NavigationPage.SetTitleIcon(this, "my_icon"); for iOS (all I needed)

edooley avatar Sep 09 '18 15:09 edooley

Add did solve it like this in my code: Added a custom property in MyNavigationPage called GetUseParentParent() that is true in tabbed pages. It is used in the SetupNavBar(CGSize size). Like this:

                if (MyNavigationPage.GetUseParentParent(Element))
                {
                    ParentViewController.ParentViewController.NavigationItem.TitleView = containerView;
                    ParentViewController.ParentViewController.NavigationItem.TitleView.SetNeedsDisplay();
                }
                else
                {
                    ParentViewController.NavigationItem.TitleView = containerView;
                    ParentViewController.NavigationItem.TitleView.SetNeedsDisplay();
                }

ElderLars avatar Nov 15 '18 09:11 ElderLars

Perfect solution. But I can’t apply it to tabs. Please, help! Android Application.Current.MainPage = new CustomNavigationView(new MainView());

MainView : TabbedPage into MainView xaml <views:MyCardsView x:Name="MyCardsPage" />

MyCardsView : CustomView

CustomView and CustomNavigationView - from this project

ughunter avatar Apr 25 '20 09:04 ughunter