Reputation: 4342
Here the default backKey button when a page is created:
The problem:
How to override this ? I want to check something before this 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(); }
Upvotes: 0
Views: 153
Reputation: 15296
UPDATE 1
protected override void GoBack(object sender, RoutedEventArgs e)
{
base.GoBack(sender, e);
//Your logic goes here
}
I think you are using LayoutAwarePage
class. It has implementation of GoBack
event. You can edit the implementation. LayoutAwarePage.cs will be in common folder of project.
Upvotes: 0