您好我刚开始使用xamarin尝试开发跨平台应用程序,但我的winphone项目很早就遇到了问题。
我有一个标签页,其中包含2个导航页面。这两个导航页面都具有相同的内容,唯一不同的是每个标题。在选项卡页面之间滑动时会出现问题。当第一次加载它正确呈现,但一旦我绕过标签,我似乎失去了标题,另一个1跳到页面的顶部,我不想要。位置标签页呈现正常。
MainPage.xaml中
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:iLarm;assembly=iLarm"
x:Class="iLarm.MainPage">
<NavigationPage Title="Alarm">
<x:Arguments>
<local:AlarmListPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Location" >
<x:Arguments>
<local:LocationListPage />
</x:Arguments>
</NavigationPage>
</TabbedPage>
AlarmListPage.xaml
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iLarm.AlarmListPage"
Title="iLarm">
</ContentPage>
locationListPage.xaml
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iLarm.LocationListPage"
Title="iLarm">
</ContentPage>
答案 0 :(得分:0)
根据你的代码,我写了一个演示。但是ContentPage
的标题根本没有显示出来。
根据您的屏幕截图,我想您想要将标题添加到TabbedPage
的顶部。根据此要求,您只需在下面设置Title
个TabbedPage
。
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:iLarm;assembly=iLarm"
x:Class="iLarm.MainPage"
Title="iLarm">
<NavigationPage Title="Alarm">
<x:Arguments>
<local:AlarmListPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Location">
<x:Arguments>
<local:LocationListPage />
</x:Arguments>
</NavigationPage>
</TabbedPage>