Xamarin Forms: How to add controls on MasterDetail Tool Bar

雨燕双飞 提交于 2019-12-24 09:04:03

问题


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.

Code:

<?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>

Thanks.


回答1:


If you talking about this kind of controls as on image than:

"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

There is plenty of examples available:

https://forums.xamarin.com/discussion/17339/navigationpage-and-toolbaritems

https://forums.xamarin.com/discussion/17351/making-a-toolbar



来源:https://stackoverflow.com/questions/40615109/xamarin-forms-how-to-add-controls-on-masterdetail-tool-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!