我创建了一个DotNet Maui应用程序.对于某些页面,需要禁用Android的后退按钮.
我找到了这个article ,但它只在主页上起到了作用. 有什么办法可以禁用它吗?
这是页面XAML文件:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="UI.Pages.ScreenPlacementSelectingPage"
Shell.NavBarIsVisible="false"
Title="">
<Shell.BackButtonBehavior>
<BackButtonBehavior IsEnabled="False">
</BackButtonBehavior>
</Shell.BackButtonBehavior>
<Grid x:Name="AbsolutLayout"
VerticalOptions="Center"
HorizontalOptions="Center"
>
<Image
x:Name="UIbackground"
Aspect="Fill"
Source="uibackground.png"
/>
<Grid x:Name="gridLayout"
RowDefinitions="*,Auto,Auto,*"
ColumnDefinitions="*,Auto,Auto,*"
>
</Grid>
</Grid>
</ContentPage>