这里是创建页面时的默认backKey按钮:
问题:
如何覆盖这个?我想在这个backKey canGoBack之前检查一下!
<Button Content="Button" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}" HorizontalAlignment="Left"
Margin="16,15,0,0" VerticalAlignment="Top" Height="55"/>
---- Update : in LayoutAwarePage.cs
protected virtual void GoBack(object sender, RoutedEventArgs e)
{
// Use the navigation frame to return to the previous page
if (this.Frame != null && this.Frame.CanGoBack) this.Frame.GoBack();
}
1 回答
UPDATE 1
我认为你正在使用
LayoutAwarePage
类 . 它实现了GoBack
事件 . 您可以编辑实施 . LayoutAwarePage.cs将在项目的公共文件夹中 .