How can I add a frame as a toolbar item in toolbar xamarin forms

818 Views Asked by At

Image:

Image

I would like to add a frame to toolbar in Xamarin forms. But toolbar is not accepting.

1

There are 1 best solutions below

1
Bruno Caceiro On

You cannot add a frame as a Toolbar Item.

You can use, for example the TitleView and customize the whole NavigationView yourself.

For example:

 <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:TitleViewSample"
             x:Class="TitleViewSample.MainPage">

<NavigationPage.TitleView>
        <StackLayout Orientation="Horizontal">
             <Label Text="Hello World" HorizontalOptions="Center"/>
            <Frame BackgroundColor="Yellow" HorizontalOptions="End"/>
        </StackLayout>
    </NavigationPage.TitleView>

</ContentPage>