Last active
March 16, 2019 10:03
-
-
Save reddvid/af859ad558164c3d0631704142d12f7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnNavigated(object sender, NavigationEventArgs e) | |
{ | |
// Each time a navigation event occurs, update the Back button's visibility | |
SystemNavigationManager.GetForCurrentView ().AppViewBackButtonVisibility = | |
((Frame)sender).CanGoBack ? | |
AppViewBackButtonVisibility.Visible : | |
AppViewBackButtonVisibility.Collapsed; | |
} | |
private void RootFrame_PointerPressed(object sender, PointerRoutedEventArgs e) | |
{ | |
Frame rootFrame = Window.Current.Content as Frame; | |
if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) | |
{ | |
var properties = e.GetCurrentPoint(rootFrame).Properties; | |
bool backPressed = properties.IsXButton1Pressed; | |
bool forwardPressed = properties.IsXButton2Pressed; | |
if (backPressed ^ forwardPressed) | |
{ | |
if (backPressed && rootFrame.CanGoBack) | |
{ | |
rootFrame.GoBack(); | |
} | |
if (forwardPressed && rootFrame.CanGoForward) | |
{ | |
rootFrame.GoForward(); | |
} | |
e.Handled = true; | |
} | |
} | |
} | |
private void OnBackRequested(object sender, BackRequestedEventArgs e) | |
{ | |
Frame rootFrame = Window.Current.ContentasFrame; | |
if (rootFrame.CanGoBack) | |
{ | |
e.Handled = true; | |
rootFrame.GoBack(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment