问题描述
我正在Xamarin Forms中创建一个主详细信息页面.我想在左上方显示菜单"图标,在右上方显示搜索器",并在菜单栏上显示另一个标签.
I am creating a master detail page in Xamarin Forms. I want to have Menu icon on top left, searcher on the right and another label on the menu bar.
有什么可以帮助我完成工作的方法吗?我添加了菜单图标.我需要有关在工具栏/菜单栏/导航栏上添加其他控件的帮助,无论它叫什么.其位于主详细信息页面顶部的栏.
Can some help help me with how I can be done? I added the menu icon. I want help with adding other controls on the toolbar/Menubar/Navigation bar what ever it is called. Its the bar on top of the master detail page.
代码:
<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
xmlns:local="clr-namespace:PCL.Core.Views;assembly=PCL.Core"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="PCL.Core.Views.RootPage" MasterBehavior="Popover" >
<MasterDetailPage.Master>
<local:MasterPage/>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage BarBackgroundColor="Maroon" >
<x:Arguments >
<local:DetailPage />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
谢谢.
推荐答案
如果您在图像上谈论的这种控件比:
If you talking about this kind of controls as on image than:
您在MasterDetail页面中设置的汉堡菜单"图像;图标(图像上的GPS和DATA)-是您需要添加到详细信息页面"的ToolbarItem.
"Hamburger menu" image you set in MasterDetail page;Icons (GPS and DATA on image) - are ToolbarItem's that you need to add to Detail Page
有很多可用的示例:
https://forums.xamarin.com/discussion/17339/navigationpage和工具栏项目
https://forums.xamarin.com/discussion/17351/making -a-工具栏
这篇关于Xamarin表单:如何在MasterDetail工具栏上添加控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!