Locking navigation
How many times have you completed a form and forgotten to save it before navigating to another page? It happens to everyone. The NavigationLock
component can be used to notify the user that they are about to navigate away from the current page and allow them to cancel that action. It does that by intercepting navigation events.
This is a sample NavigationLock
:
<NavigationLock ConfirmExternalNavigation="true"
OnBeforeInternalNavigation="HandleBeforeInternalNav" />
The NavigationLock
class includes two properties:
ConfirmExternalNavigation
– gets or sets whether the user should be asked to confirm external navigations. The default value isfalse
.OnBeforeInternalNavigation
– gets or sets the callback that is invoked when an internal navigation event occurs.
This is a sample method that is invoked from the OnBeforeInternalNavigation
property:
private async Task HandleBeforeInternalNav...