Add generic GoBack and remove legacy GoBackTo #3101
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
With #2818 the behavior of
GoBack
was extended to support navigating back to a specificviewName
in the stack.But there is currently no generic version of GoBack in the
NavigationBuilder
.This PR adds the generic
GoBack<TViewModel>()
to theNavigationBuilder
.As suggested by dansiegel I have removed the legacy
GoBackTo<TViewModel>()
instead of marking it as obsolete.The old
GoBackTo
worked differently and popped each page and calledCanNavigateAsync
,OnNavigatedFrom
, andOnNavigatedTo
of each page. Maybe there are cases when this is the desired behavior. So if you want to keep the old behavior, I suggest giving this methods a clear name to easily distinguishGoBack
andGoBackTo
. Just let me know and I can update the PR.Bugs Fixed
None
API Changes
List all API changes here (or just put None), example:
Added:
Removed:
Behavioral Changes
GoBackTo was removed and GoBack works without calling
CanNavigateAsync
,OnNavigatedFrom
, andOnNavigatedTo
of each page.PR Checklist