-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[UWP] Make Navigation and Transition overridable for NavigationPage #12439
Conversation
do you think we can have this for 5.0? I really want to finish UWP sharedtransitions so i can ask the toolkit if they want them when everything is done :) |
@GiampaoloGabba Yes, SharedTransitions will be a very nice addition to the Toolkit. |
a26bd53
to
81f5157
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GiampaoloGabba is this true?
Bringing the UWP NavigationRenderer in par with iOS & Android.
Looking through the other platforms it seems like only the Shell renderer exposes these as virtual but maybe I'm missing something obvious here?
Hi @PureWeen What i meant was to have in UWP the ability to override the navigation behaviours in a "similar" way like we do in iOS & Android. Here a brief description of what we have in iOS & Android. iOSwe can override these methods from the renderer:
And we can even override methods from the
Regarding the transition, we can customize it by overriding:
AndroidSimilar to iOS, the Android renderer exposes these virtual members:
We can customize the transition by overriding this method:
UWP with my PRThis PR adds the following virtual methods:
Then there is the So in the end we have 5 virtual methods like Android & iOS (even tough in iOS the transition management is a little different, because we override a UIViewController method, and not the renderer's one). |
@GiampaoloGabba do you by chance know if we can match the behavior on iOS/Android with how it uses Tasks? I'm pretty sure those tasks are designed to resolve once an animation completes and we've navigated. |
@PureWeen Sincerely i dont know. The last time i tried to "play" with task and Navigation in UWP i gave up, i was getting a lot of random MemoryAccess violation that drove me crazy.... (expecially when navigation fast between pages). It would be cool to have Tasks here like in iOS & Android but i'm a bit "scared", given my past on the subject. |
@GiampaoloGabba yea :-/ if there's a way I haven't found it. Best I can figure is to some how interpret the LayoutChanged event to determine once it's done but that just seems excessive Just to narrow down added APIs from this PR could we not open up these APIs? OnPopRequested
OnPopToRootRequested
OnPushRequested What's the use case for these ones? I realize it makes it more consistent but just curious the use case to make sure just adding virtual to those serves the right purpose :-) |
@PureWeen to be honest they are here primarily for consistence with other platforms. But they can be used to semplify our code (for example if i need to do something only on push, i can use the Plus, during a PopRequest, if we use only |
/azp run |
No pipelines are associated with this pull request. |
Description of Change
The
NavigationRenderer
for UWP doesn't expose any virtual method to override, closing a lot of possibilities expecially for plugin authors.This PR comes after a conversation on Twitter with @PureWeen and adds the
protected virtual
access level to the following, existing, methods:OnPopRequested
OnPopToRootRequested
OnPushRequested
OnElementChanged
Bringing the UWP NavigationRenderer in par with iOS & Android.
Plus i created a new method
SetupPageTransition
to override the default transition (but making sure to maintain the_transition
cache for the default transition).API Changes
Added:
void SetupPageTransition(Transition transition, bool isAnimated, bool isPopping)
isPopping is needed to create a custom transition based on push or pop
Changed:
protected virtual void OnPopRequested(object sender, NavigationRequestedEventArgs e)
protected virtual void OnPopToRootRequested(object sender, NavigationRequestedEventArgs e)
protected virtual void OnPushRequested(object sender, NavigationRequestedEventArgs e)
Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
Not applicable
Testing Procedure
PR Checklist