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.

Why <NavigationPage.TitleView> does not work in TabbedPage?

kingston5555kingston5555 Member ✭✭✭

<NavigationPage >
<x:Arguments>
<controls:TabIconsPage/>
</x:Arguments>
<NavigationPage.TitleView>
<StackLayout Orientation="Horizontal">
<ImageButton Source="Taxi.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="EndAndExpand"/>
</StackLayout>
</NavigationPage.TitleView>
</NavigationPage>
<NavigationPage>
<x:Arguments>
<controls:TabIconsPage/>
</x:Arguments>
<NavigationPage.TitleView>
<StackLayout Orientation="Horizontal">
<ImageButton Source="Taxi.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="EndAndExpand"/>
</StackLayout>
</NavigationPage.TitleView>
</NavigationPage>

I want to make a tabbed page with different images in tabbar but it does not work.Please help.I want to make different size of images

Answers

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    NavigationPage.TitleView is an attached property. You set it on the child of the NavigationPage, not on the NavigationPage itself.

  • kingston5555kingston5555 Member ✭✭✭

    Sorry but I did not fully understand. How do I then fix this code snippet? so that I could insert pictures into the tabbar and resize as I wanted before

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Move the whole <Navigation.TitleView> section into TabIconsPage.xaml.

  • kingston5555kingston5555 Member ✭✭✭

    Can you wrote small example code? because I do not undestand

  • kingston5555kingston5555 Member ✭✭✭

    I want to do tabbed page with 4 pages and in NavigationPage.TitleIcon I want images with different size.How can I do it?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    @kingston5555 said:
    Can you wrote small example code? because I do not undestand

    <TabbedPage>
        <NavigationPage.TitleView>
            <StackLayout Orientation="Horizontal">
                <ImageButton Source="Taxi.png" WidthRequest="50" HeightRequest="50" HorizontalOptions="EndAndExpand"/>
            </StackLayout>
        </NavigationPage.TitleView>
    
        <ContentPage Title="Tab 1" IconImageSource="tab1.png"/>
        <ContentPage Title="Tab 2" IconImageSource="tab2.png"/>
        <ContentPage Title="Tab 3" IconImageSource="tab3.png"/>
    </TabbedPage>
    
  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Or do you mean you want those to be the icons you tap to switch between tabs?

  • kingston5555kingston5555 Member ✭✭✭

    Can I change size of IconImageSource?

  • kingston5555kingston5555 Member ✭✭✭

    @JoeManke said:
    Or do you mean you want those to be the icons you tap to switch between tabs?

    yes, i want to resize these icons

  • kingston5555kingston5555 Member ✭✭✭
    edited October 13

    <TabbedPage.Children>
    <NavigationPage Title="Items">
    <x:Arguments>
    <!-- Set Title Icon Here-->
    <controls:TabIconsPage />
    </x:Arguments>
    <NavigationPage.TitleView>
    <StackLayout Orientation="Horizontal" VerticalOptions="Center" Spacing="10">
    <Image Source="favorite_icon">
    </Image>
    <Label Text="3.2.0" FontSize="16" TextColor="Black" VerticalTextAlignment="Center" />
    </StackLayout>
    </NavigationPage.TitleView>

    I wanted something like this but it does not work

    <NavigationPage Title="Items">
    <x:Arguments>
    <!-- Set Title Icon Here-->
    <controls:TabIconsPage />
    </x:Arguments>
    <NavigationPage.Icon>
    <OnPlatform x:TypeArguments="FileImageSource">
    <On Platform="Android" Value="Taxi"/>
    </OnPlatform>
    </NavigationPage.Icon>

    this code works but I want to resize icon

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    I think Android automatically scales all tab icons to be the same size, so you would need to use a custom renderer to mess with that.

  • LandLuLandLu Member, Xamarin Team Xamurai

    Please do not post duplicated threads for one single topic.
    Try to discuss the issues here:
    https://forums.xamarin.com/discussion/185490/how-to-change-size-of-icon-in-toolbar-xamarin-forms

Sign In or Register to comment.