Windows Phone - OnNavigatingFrom - Problem

I believe this is just a problem for me, due to my lack of programming capabilities. I am currently studying the transitions between page navigation using Windows Phone applications. I initially used storyboards and completed event handlers so that my pages appear on the screen and beyond. This leads to a problem when you want to go to many pages from one page using the same transition.

So, I started watching OnNavigatedTo and OnNavigatingFrom events, and although it works fine for OnNavigatedTo, a later version does not work. It seems that the assembly Microsoft.Phone.Navigation does not contain OnNavigatingFrom and refers to System.Windows.Navigation, it compiles fine, but I can not get the pages for the animation when navigating.

I have a button on my page that I want to return to my MainPage (after I flipped back the key with the field for testing). I have transitions made on the page, and I have it as an event handler code ...

private void btnP2_BackToP1Clicked(object sender, System.Windows.RoutedEventArgs e) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } 

Using this code for the OnNavigatedTo and OnNavigatingFrom events ...

 protected override void OnNavigatedTo(PhoneNavigationEventArgs e) { PageTransition_In.Begin(); } // // protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { PageTransition_Out.Begin(); base.OnNavigatingFrom(e); } 

I have the feeling that OnNavigatingFrom cannot (yet) be supported for Windows Phone Apps. OnNavigatedFrom is part of Microsoft.Phone.Navigation, but it only performs actions after the page is no longer active, which is too late to perform any animation effects.

+4
source share
3 answers

I believe that you need to add an event that captures the completion of the transition. Check out the demo that Microsoft provides for the list view app.

0
source

The approach you take is not entirely correct. Instead, it's best to change the page frame to know how to make page transitions. You can see good examples of this on channel 9 vid or on the Avi Pilosof Blog .

Example:

 <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:PhoneApplicationFrame"> <Border> <toolkit:TransitioningContentControl Content="{TemplateBinding Content}" Transition="DownTransition" /> </Border> </ControlTemplate> 
0
source

I am confused why we need to download our own smooth transitions for WinPhone7, but it is. Jeff Brand ( SlickThought.net ) seems to have a better solution. Here is a good article with step-by-step video and sample code, although its sample code in the article was for the April CTP and seems to have been broken in beta tools.

0
source

Source: https://habr.com/ru/post/1304690/


All Articles