Forum Xamarin.Forms

TabbedPage must be Obsolete?

DeZtheKidDeZtheKid Member ✭✭
edited January 6 in Xamarin.Forms

So I am working with a TabbedPage (called TabPage) and I am trying to set the bar color, bar item color, and set it to the bottom of the screen when on Android, but it throws an error. The only way to resolve that error is to make the TabbedPage Obsolete. Does anyone know why this happens?

Here is the Code:

using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using Xamarin.Forms.Xaml;

namespace RxAnywhere
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class TabPage : Xamarin.Forms.TabbedPage
    {
        [Obsolete]
        public TabPage()
        {
            InitializeComponent();
            BarBackgroundColor = Color.FromHex("#FFC0C0");
            _ = On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetBarItemColor(Color.Black).SetBarSelectedItemColor(Color.FromHex("#FF7171"));
        }  

    }
}

Best Answer

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    edited January 6 Accepted Answer

    please use following code

                _ = On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
                this.SelectedTabColor=Color.FromHex("#FF7171");
                this.UnselectedTabColor = Color.Black;
    

    to replace _ = On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetBarItemColor(Color.Black).SetBarSelectedItemColor(Color.FromHex("#FF7171"));


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    edited January 6 Accepted Answer

    please use following code

                _ = On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
                this.SelectedTabColor=Color.FromHex("#FF7171");
                this.UnselectedTabColor = Color.Black;
    

    to replace _ = On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetBarItemColor(Color.Black).SetBarSelectedItemColor(Color.FromHex("#FF7171"));


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Are there any update for this issue? If reply is helpful, please accept it as answer(Click the Yes under the answer), if will help others who have similar issue.


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Sign In or Register to comment.