AAHN
AAHN

Reputation: 401

Add Title For xamarin.forms Master Page Contain TabbedPage as Details page

I using Master Detail page

The Detail page is an tabbed page

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" ...... >
    <views:InboxPage    Title="" Icon="tabb_inbox.png" />
    <views:AgendaPage    Title="" Icon="tabb_agenda.png"/>
    <views:AttendancePage    Title="" Icon="tabb_attendance.png"/>
    <page:CalendarPage Title="" Icon="tabb_calendar.png" ></page:CalendarPage>
    <views:MarksPage    Title="" Icon="tabb_marks.png"/>
    <!--<views:CalendarPage Title="" Icon="tabb_calendar.png" />-->


</TabbedPage>

The Menu(masterpage) is a Content page :

     public partial class MasterPageMenu : ContentPage
        {
            public MasterPageMenu()
            {
                InitializeComponent();
                InitializeDataAsync();
}
}

in the master Page render using the following

 public partial class MasterPage : MasterDetailPage
    {
  public MasterPage()
        {
Detail = new NavigationPage(bottomBarPage);

        Master = new MasterPageMenu()
        {
            Title = "The Title ",

            Icon = (Device.OS == TargetPlatform.iOS) ? "icon.png" : null
        };
}
}

Is There Any way to display page title beside the menu Icon

the result for above code like this

Upvotes: 0

Views: 653

Answers (1)

Jordy Dieltjens
Jordy Dieltjens

Reputation: 1538

I usually pass the title in program code as follow ( when navigating to the page ).

new tabbedPafe(){ Title = 'Put title here'};

But I think you can also do it in your XAML code if you prefer that (of your tabbed page, give it the Title attribute).

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" ...... Title="Title here">


 <views:InboxPage    Title="" Icon="tabb_inbox.png" />
    <views:AgendaPage    Title="" Icon="tabb_agenda.png"/>
    <views:AttendancePage    Title="" Icon="tabb_attendance.png"/>
    <page:CalendarPage Title="" Icon="tabb_calendar.png" ></page:CalendarPage>
    <views:MarksPage    Title="" Icon="tabb_marks.png"/>
    <!--<views:CalendarPage Title="" Icon="tabb_calendar.png" />-->

</TabbedPage>

Upvotes: 0

Related Questions