将辅助工具栏的3点更改为xamarin形式的图标

问题描述:

我想将默认的"3点"(显示次要项目)替换为xamarin形式的页面标题栏上的文本或图标. 这可能吗,我该如何实现?

I want to replace the default '3 dots'(that displays the secondary items) to text or icon on the title bar of a page in xamarin forms. Is this possible and how can I achieve this?

感谢您的提前答复.

确保在C#中添加将用于处理Activated事件的方法.

在XAML中,在ContentPage.Content的开始标记之前,添加以下代码.

In XAML, before the opening tag of your ContentPage.Content, add the code below.

从点到文本

<ContentPage.ToolbarItems>
    <ToolbarItem Text="Hi" Clicked="Clicked_1"/>
    <ToolbarItem Text="Hello" Clicked="Clicked_2"/>
</ContentPage.ToolbarItems>

从点到图标

<ContentPage.ToolbarItems>
    <ToolbarItem Icon="icon.png" Activated="Clicked_3" Text="Icon" Order="Primary"/>
</ContentPage.ToolbarItems>