我创建了一个简单的Xamarin应用程序,其中包含两个页面,每个页面都可以通过制表符进行访问,如下所示:
Android目标正常工作(如上面的屏幕快照所示),因此我现在添加了UWP目标。问题在于,UWP目标仅显示一页,即没有选项卡,因此无法在两个页面之间进行选项卡显示。
如何将选项卡添加到UWP应用?请注意,创建UWP应用时,我使用了选项卡模板。
其他所有内容均按预期工作(选项卡除外)。
我正在使用Visual Studio 2017。
这是主页的XAML:
<ContentPage.ToolbarItems>
<ToolbarItem
Command="{Binding SettingsCommand}"
Text="Settings">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS, Android" Value="app_settings" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/app_settings.png" />
</OnPlatform>
</ToolbarItem.Icon>
</ToolbarItem>
</ContentPage.ToolbarItems>
<TabbedPage.Title>
<OnPlatform x:TypeArguments="x:String">
<On Platform="iOS, UWP, WinRT, WinPhone" Value="MyNamespace" />
</OnPlatform>
</TabbedPage.Title>
<views:TestEnquiriesView
x:Name="TestView">
<views:TestEnquiriesView.Title>Test</views:TestEnquiriesView.Title>
</views:TestEnquiriesView>
<views:ProfileView
x:Name="ProfileView">
<views:ProfileView.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS, Android" Value="menu_profile" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets\menu_profile.png" />
</OnPlatform>
</views:ProfileView.Icon>
</views:ProfileView>
您可以尝试在的子元素上添加Title属性TabbedPage
。在UWP中,TabbedPage
识别Title
子元素的属性并将其用作选项卡的显示文本。
此行为与Android不同。在Android中设置的图标不能在UWP中显示为文本。
这是TabbedPage文档。
最好的祝福。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句