Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Toolbar Items on Carousel Page

$
0
0

Hi guys,
I'm trying to put a toolbar in my Carousel Page but it doesn't appear. Can you please help me? Is it possible to do that? Here's my code:

void Home_Appearing(object sender, EventArgs e)
        {
            this.ViewModel.Loaded += ViewModel_Loaded;

            ToolbarItem toolbar = new ToolbarItem();
            toolbar.Name = "Teste";
            toolbar.Priority = 1;
            toolbar.Order = ToolbarItemOrder.Primary;

            ToolbarItem toolbar2 = new ToolbarItem();
            toolbar.Name = "Teste";
            toolbar.Priority = 1;
            toolbar.Order = ToolbarItemOrder.Secondary;

            page1.ToolbarItems.Add(toolbar);
            page1.ToolbarItems.Add(toolbar2);
        }

And here's my Content Page inside the Carousel:

<CarouselPage.Children>
      <ContentPage x:Name="page1">
        <StackLayout>
          <Label Text="{Binding StaticContent.NewRequestSectionTitle}" Font="40"/>
            <Button Text="+" BackgroundColor="Blue" Font="110" Clicked="OnNewRequest_Tap" />
            <Label Text="EXAMPLE"/>
        </StackLayout>
      </ContentPage>
</CarouselPage.Children>

Is there a way to add the toolbar on all Content Page's of the Carousel simply?

I've already tryed to do this in XAML but it doesn't work either:

<CarouselPage.ToolbarItems>
    <ToolbarItem Name="XX" Text="ZZ"/>
  </CarouselPage.ToolbarItems>

Tks.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>