Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Change navigation bar color or eliminate it

pauldanut94pauldanut94 Member ✭✭
edited February 6 in Xamarin.Forms

Hi,
I've created a CarouselPage which contains 3 ContentPage. I want to achieve the next functionality:

  • when I open the app for the first time (after install), I want to display that pages and on the last one, a kind of button like Accept. When clicking Accept, I want to navigate the user to the MainPage.
  • after first use of the App, I don't want to display these pages anymore.

To do this, I've done the next steps:

  • created CarouselPage with 3 pages.
  • in App.xaml.cs:

        public App()
            {
                InitializeComponent();
                if (FirstTimeOpen())
                {
                    MainPage = new NavigationPage(new Page1());
                }
                else
                {
                    MainPage = new MainPage();
                }
            }
            public bool FirstTimeOpen()
            {
                bool isFirstTime = false;
    
                var value = Preferences.Get("wasOpened","");
                if (value.Equals("true"))
                {
                    isFirstTime = false;
                }
                else
                {
                    isFirstTime = true;
                }
    
                return isFirstTime;
            }
    

and in Page1.xaml.cs:

               public Page1()
                {
                    InitializeComponent();
                }

                public void SetApplicationWasOpened()
                {
                    Preferences.Set("wasOpened", "true");
                }

                private void Button_Clicked(object sender, EventArgs e)
                {
                    SetApplicationWasOpened();
                    Navigation.PushAsync(new MainPage());
                }

This works fine but I'd like not to display the navigation bar when I swipe the carousel pages, or at least to color it white.

Thank you!

Best Answer

Answers

Sign In or Register to comment.