Xamarin.forms Toolbar Android
Is there a way to have the toolbaritems display right below the navigation bar? I also noticed that when I click a button within my toolbar to navigate to a new page the toolbar fl
Solution 1:
Is there a way to have the toolbaritems display right below the navigation bar?
In Xamarin.Forms
, you could use ToolbarItem to implement this feature.
If you want display ToolbarItem
at the right corner, set the order
of the ToolBarItem
to Secondary
to force the option into an overflow menu on Android :
<ContentPage.ToolbarItems><ToolbarItemText="Share"Activated="EditClicked_Share"Order="Secondary" /><ToolbarItemText="Create"Activated="EditClicked_Create"Order="Secondary" /></ContentPage.ToolbarItems>
Effect :
If you want display ToolbarItem
right below the navigation back button,
<ContentPage.ToolbarItems>
<ToolbarItem Text="Share" Activated="EditClicked_Share"Order="Primary" Priority="0" />
<ToolbarItem Text="Create" Activated="EditClicked_Create"Order="Primary" Priority="1" />
<ToolbarItem Text="Save" Activated="EditClicked_Save"Order="Primary" Priority="2" Icon="ic_action_content_save.png" />
</ContentPage.ToolbarItems>
Effect :
Remember to wrap your Modal in a NavigationPage, as the ToolbarItems
otherwise will not appear. For more information, you could refer to the article and this question.
Post a Comment for "Xamarin.forms Toolbar Android"