-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnActivate should not be called #342
Comments
Did some more tests today, putting breakpoints in the OnAppearing event of a page. When leaving a Page, its OnAppearing event is being fired. That's why the OnActivate method is also called. |
Well I'm not so sure anymore. I took the Xamarin Forms sample and ran the NavigationSample. The OnAppearing method is correctly called. The CM samples can also reproduce the bug. |
Finally found some time to look into this, it's most likely caused by these lines which should remove the event handler after it's fired. |
I made the change and it works. |
There's a side effect with the fix. |
Hi Iploumen, |
Hi Yakyyaky, |
I worked around the issue in a specific way that works for my requirement. This meant that I basically abandoned XF's NavigationPage. And used Navigation with Application.MainPage instead. There are benefits and limitations to this.
Things I Did for my own NavigationService:
|
Hi,
@nigel-sampson Your proposed fix would not work because if you remove the event handler after it is fired, when you go back to page A, it would not call the OnActivate method. |
I had these problems when using Xamarin Forms with a Windows Phone Silverlight application. |
I'd love to move away from Right now however it's our only option. While The inconsistency of the events firing on different platforms in different ways is also proving problematic. I'm going to have a play around tonight with the Would mean however that activation would have happen immediately and not when the page appears so would need to be something guarding against that. |
@lploumen there's an update on the Thanks |
I tested using the samples branch and my app. From what I see, everything looks good, although I need to test it a bit more. |
Cheers, I'll cherry pick the change over to master in a few days barring any issues from you. |
@lploumen assume no issues here? |
Looks good to me |
Added the changes to master, will be in the next release. |
Hi,
I noticed something strange when running the Features sample from the Samples branch. I am executing the Features.Forms.WinPhone sample. I updated to the latest XF nuget version.
I go to the Conductors view, at then end of the list and play a bit with tabs, no problem.
When going back this view, OnDeactivate from ConductorViewModel is called, but also OnActivate which, I guess should not be called.
I did not notice this problem with the XF version included in the sample.
My original problem is that I included a WebView inside a ContentView which is included in a TabbedPage (using cm:View.Model="{Binding}" in the TabbedPage.ItemTemplate, like in the sample). The first time I display the TabbedView with the WebView, it is correctly displayed, but the second time, the WebView is flickering. If I don't use the CM mechanism ( = directly add my ContentView in <TabbedPage.Children>), it works.
That's why I suspect some events are wired twice to it although I'm not sure.
The text was updated successfully, but these errors were encountered: