Riccardo Raffini
Riccardo Raffini

Reputation: 396

How to remove action bar in xamarin form?

I have a xamarin forms app. My app's head is this:

enter image description here

I would like to remove or hide the green bar (btw is it called actionbar ?)

My App.xaml is this:

<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="AddaDiLeonardo.App"
             NavigationPage.HasNavigationBar="False">

    <Application.Resources>
        <ResourceDictionary>
            <!--Global Styles-->
            <!--Color x:Key="NavigationPrimary">#FFFFFF</-->
            <Style TargetType="NavigationPage">
                <!--Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" /-->
                <Setter Property="BarBackgroundColor" Value="Green"/>
                <Setter Property="BarTextColor" Value="Red" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>

</Application>

while my MainPage.xaml is this:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:d="http://xamarin.com/schemas/2014/forms/design"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            mc:Ignorable="d"
            xmlns:views="clr-namespace:AddaDiLeonardo.Views"
            x:Class="AddaDiLeonardo.Views.MainPage"
            SelectedTabColor="Blue"
            UnselectedTabColor="DarkGray"
            BarBackgroundColor="White"
            Title="Adda di Leonardo"
            >
    <TabbedPage.Children>
        <!--Caricamento dinamico-->
    </TabbedPage.Children>

</TabbedPage>

I have tried editing the xaml files, cs files and style too, but I can't figure it out.

I would like the solution to work on both android and ios if it is possible.

Thanks for your help!

Upvotes: 2

Views: 1119

Answers (2)

Riccardo Raffini
Riccardo Raffini

Reputation: 396

I solve this problem setting this:

NavigationPage.HasNavigationBar="False"

Not in TabbedPage.xaml or App.xaml, but in the children pages I load in the TabbedPage.

Upvotes: 3

notarealgreal
notarealgreal

Reputation: 686

Try something like this in the .xaml

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
NavigationPage.HasNavigationBar="False">

Upvotes: 1

Related Questions