【发布时间】:2021-07-18 21:40:42
【问题描述】:
我有一个ContentPage,它作为ShellContent 分配给Xamarin.Forms.Shell 类,并要求在ContentPage 的导航栏中显示返回按钮。
关注的ContentPage的XAML来源如下:
<?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="UI_test.TestPage">
<Shell.NavBarIsVisible>True</Shell.NavBarIsVisible>
<Shell.BackButtonBehavior>
<BackButtonBehavior IsEnabled="True" />
</Shell.BackButtonBehavior>
<Shell.FlyoutBehavior>Disabled</Shell.FlyoutBehavior>
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
我发现为<BackButtonBehavior>标签的TextOverride和IconOverride属性分配自定义值会显示返回按钮,但我正在寻找一种显示平台默认返回按钮的方法(而不是一个自定义的)如上面的ContentPage 不会在其导航栏中显示为后退按钮,如下面的屏幕截图所示。
提前致谢。
【问题讨论】:
标签: c# xamarin xamarin.forms xamarin.forms.shell