Change TabbedPage MainTitle Color, when user open by Navigation.PushAsync(tabbedPage)

dev_bdev_b PTMember ✭✭

So, I got this problem, and I don't know to solve.
Basically, I would like to change the TabLayout's mainTitle color, when i call from Navigation.PushAsync(tabbedPage); Seems easy, but it isn't.
I don't know to change any property, of that top bar...
I see, a property, in a NavigationPage class called "BarTextColorProperty". What can I do with this?

I had tested, a same sample, but in another method... Navigation.PushModalAsync(tabbedPage), this time, in a modal page, and worked :smile:

But, I really need this work in a Navigation.PushAsync(tabbedPage), because backButton.

To finish, I know, if you look the code, you see that Navigation.PushModalAsync(tabbedPage), the tabbedPage is inside a NavigationBar, and Works, but I try to put a tabbedPage inside a NavigationPage(in PushAsync method;) , and the Xamarin, draws 3 bars... The first bar, has only a back button...

Can someone help???
If, you need more code, tell me :smile:

Code:
-> Navigation.PushAsync(tabbedPage);

 button1.Clicked += (s, e) =>
        {
            tabbedPage.CurrentPageChanged += (a, b) =>
            {
                if (tabbedPage.CurrentPage.GetType().Equals(typeof(Page1)))
                {
                    tabbedPage.BarTextColor = Color.Green;
                }
                else
                {
                    tabbedPage.BarTextColor = Color.Orange;
                }
            };
            Navigation.PushAsync(tabbedPage);
        };

-> Navigation.PushModalAsync(tabbedPage),

button2.Clicked += (s, e) =>
        {
            NavigationPage navigationPageTabbedPage = new NavigationPage(tabbedPage);
            tabbedPage.CurrentPageChanged += (a, b) =>
            {
                if (tabbedPage.CurrentPage.GetType().Equals(typeof(Page1)))
                {
                    navigationPageTabbedPage.BarTextColor = Color.Green;
                }
                else
                {
                    navigationPageTabbedPage.BarTextColor = Color.Orange;
                }
            };

            Navigation.PushModalAsync(navigationPageTabbedPage);
        };
Sign In or Register to comment.