Blow overpage about the topic ,today we talk about how to navigate between pages is ,in most cases ,5 Fingers Shoes,our application not only one page ,there will be N ,as we do with that we should develop the desktop ,an application may be more than one form ( very simple program exception) ,we want to handle form between switching ;similarly ,Vibram Sale,in the Web development time ,our Web application may have more than one page ,we want to handle page switching between .
Of course ,in our mobile phone applications, also need this operation ,which we call navigation ,as a developer, we all control page switching between ,say so, we also when the App general general .
Create a new WP application project ,on the main page on a HyperlinkButton control ,the NavigateUri & # 20540 ;set / pageSecond.xaml ,and then create a new page ,named pageSecond.xaml .
< ;HyperlinkButton Content = " ;jump to page two " ;Height = " ;78" ;HorizontalAlignment = " ;Left" ;Margin = " ;126, 86, 0, 0" ;Name = " ;hyperlinkButton1" ;VerticalAlignment = " ;Top" ;Width = " ;216" ;FontSize = " ;32" ;FontStyle = " ;Normal" ;FontStretch = " ;Normal" ;NavigateUri = " ;/ / > pageSecond.
xaml" ;;second navigation method is realized through the code ,such as a button click event .Private void button1_Click ( object sender ,RoutedEventArgs E ) {this.NavigationService.
Navigate ( New Uri ( " ;pageSecond.xaml" ,Beats By Dre Headphones,UriKind.Relative / ;) ) ;} / / protected override void OnNavigatedFrom left page ( System.Windows.Navigation.NavigationEventArgs E ) {base.
OnNavigatedFrom ( E ) ;System.Diagnostics.Debug.WriteLine ( " ;* * * * * has left home page ." B ;} ) ;in a second page ,add the following code ./ / second navigate to a page protected override void OnNavigatedTo ( System.
Windows.Navigation.NavigationEventArgs E ) {base.OnNavigatedTo ( E ) ;System.Diagnostics.Debug.WriteLine ( " ;* * * * * Hi ,has come to second pages ." ;} ) ;then ,you run the program navigation ,have a look output window in it? Three ,how the page transfer parameters .
In Android development,Cheap Beats By Dre, from a Activity to another Activity ,Intent object content delivery ,however ,Dr Dre Headphones,in WP development, we need only as WEB pages in URI in that additional parameter .
Such as :/ Numbb.xaml ?PT1 = aaaa& ;pT2 = ccccc .Now ,we have the example of change ,in the home not to put a TextBox ,we want to put this page in the input content is delivered to the second page .
Private void button1_Click ( object sender ,RoutedEventArgs E ) {this.NavigationService.Navigate ( new ( " ;Uri / pageSecond.xaml ?STR = " ;textBox1.Text ,UriKind.Relative ) ) ;} second pages out of data .
In second pages to extract data ./ / second navigate to a page protected override void OnNavigatedTo ( System.Windows.Navigation.NavigationEventArgs E ) {base.OnNavigatedTo ( E ) ;/ / transmission parameter name ,here by what name to take .
Related articles:
没有评论:
发表评论