我使用主详细信息页面
详细信息页面是一个选项卡式页面
<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>
菜单(母版)是一个内容页面:
public partial class MasterPageMenu : ContentPage
{
public MasterPageMenu()
{
InitializeComponent();
InitializeDataAsync();
}
}
在母版页渲染中使用以下内容
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
};
}
}
有没有办法在菜单图标旁边显示页面标题
我通常在程序代码中传递标题如下(导航到页面时)。
new tabbedPafe(){ Title = 'Put title here'};
但我认为,如果您愿意,也可以在 XAML 代码中执行此操作(在选项卡式页面中,为其提供 Title 属性)。
<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>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句