Open JerryNixon opened 4 years ago
An alternative is to allow NavigationService.NavigateAsync
to accept PathBuilder
as an argument. This would not only NOT require creating the Uri
by the developer, but also drive them toward the type.
Once a dev creates a PathBuilder
instance using this method - are they likely to do anything to it? Or does it exist solely to create a string/(or Uri
) that is then passed into NavigateAsync
? If the latter, then why not have the below and save the need to create another object entirely:
await NavigationService.NavigateAsync(BackStackBehaviors.Clear, nameof(MyView));
You might also use the PathBuilder if you are putting a payload inside a JumpList or a Tile or inside a Toast so that you can use that payload to preload the Frame after you activate the app. I still think the best approach here is to simply allow NavigateAsync to accept PathBuilder as an argument.
var path = PathBuilder.Create(BackStackBehaviors.Clear, nameof(MyView));
await NavigationService.NavigateAsync(path, {extra in-memory parameters});
I don't see a downside to ALSO implementing ToUri()
while we are in there.
I wonder if a fluent API would be useful here.
Currently has
ToString()
which requires:This works and should not be changed.
The desired ADDITIONAL syntax would be:
It will be difficult to remember the
UriKind.Relative
part anyway.