导航栏无法显示图标

时间:2017-07-05 02:53:27

标签: xamarin.forms

这是我从P1到MainMenu页面的导航

P1 - > MainMenu页面 我想在导航栏的左侧显示一个图标。 问题:导航栏中没有显示带有以下代码的图标。

1) at P1 : I use below code to open MainMenu

        Navigation.PushAsync(new MainMenu());


2) At MainMenu.

  I wanted to include a company logo in the Navigation bar 

Problem: No icon being display in the Navigation Bar with below code.


 public partial class MainMenu : TabbedPage
    {
        public ICommand Item1Command { get; private set; }

        public MainMenu()
        {
            InitializeComponent();          

            NavigationPage.SetHasBackButton(this, true);           

            NavigationPage.SetTitleIcon(this,"itemIcon2");        

        }

this the MainMenu Page .


<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"          
            xmlns:local ="clr-namespace:MyApp.View"  
            BackgroundColor="White"
            Title="Product and Service"          
            x:Class="MayApp.View.MainMenu">
    <ContentPage.ToolbarItems>
        <ToolbarItem Name="MenuItem1" Order="Primary" Icon="itemIcon1" Command="{Binding Item1Command}"  Priority="0" />
        <ToolbarItem Name="MenuItem2" Order="Primary" Icon="itemIcon2" Priority="1" />
    </ContentPage.ToolbarItems>

    <local:Product>
    </local:Product>

    <local:Service>
    </local:Service>   

</TabbedPage>

感谢您的帮助。

由于

0 个答案:

没有答案