将辅助工具栏的3点更改为xamarin形式的图标 [英] Change 3 dots of secondary toolbar to an icon in xamarin forms

查看:95
本文介绍了将辅助工具栏的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>

这篇关于将辅助工具栏的3点更改为xamarin形式的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆