【发布时间】:2021-01-27 12:01:02
【问题描述】:
我想在 iOS 上使用 xamarin 显示非常简单的工具栏,但我看不到显示的工具栏。
我使用这个代码:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Test.MainPage">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Example Item"
IconImageSource="https://img.icons8.com/cute-clipart/64/000000/menu.png"
Order="Primary"
Priority="0" />
</ContentPage.ToolbarItems>
</ContentPage>
代码没有错误,显示为空..
需要改变什么才能看到工具栏?
【问题讨论】:
-
您如何导航到此主页?可以贴一下导航代码吗?
-
如果您是从 App.xaml.cs 导航,如 Application.Current.MainPage =new MainPage();,则将其更改为 Application.Current.MainPage = new NavigationPage(new MainPage()) ;
-
我没有导航代码我可以得到明确的文档吗?
-
如何从 App.xaml.cs 导航到 MainPage?