Page navigation for "Windows Phone Development Learning notes"

Source: Internet
Author: User



Recently spent one months to finally see the C # read (in fact, have seen Zeng Ying Teacher's video tutorial, but after reading the basic forgotten almost, when trying to develop WP very laborious, had to drop WP re-learning C #). After reading C # again, I began to learn WP development. After that, I will share with you the notes I have learned in the course of my studies, and communicate and learn together. My Weibo account is @ Horse and Kang ;



Page navigation is also in the application of the internal switch between several pages, this example can be navigated from the main interface to interface 1, Interface 2, and of course support from Interface 1, interface 2 navigation to the main interface, this is a very simple example, but no matter how complex its application principle and this is also the same. Navigation can mainly use two controls, one is Hyperlinkbuton, and the other is a button, generally in the page navigation as long as through the Hyperlinkbutton can, of course, you can choose their own habits according to personal preferences of the control;



The main interface (MainPage) is as follows:






The main interface (MainPage) XAML code is as follows:


<phone:PhoneApplicationPage
    x:Class="Page Navigation.MainPage"
    Xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    Xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    Xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    Xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    Xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    Shell: SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Black" >
        <StackPanel x:Name="TitlePanel" Grid.Row="0" >
            <TextBlock Text="Main interface" FontSize="30" FontFamily="宋"/>
            <TextBlock Text="Main Page" FontSize="80" FontFamily="仿宋"/>
            <HyperlinkButton Content="Go to Page1" FontSize="30" Foreground="Red" NavigateUri="/Page1.xaml"/>
            <HyperlinkButton Content="Go to Page2" FontSize=" 30" Foreground="Red" NavigateUri="/Page2.xaml"/>
            <Button Content="Go to Page1" FontSize=" 30" Foreground="Red" Click="Button_Click" />
        </StackPanel>
    </Grid>

</phone:PhoneApplicationPage>





The main code of the main interface (MainPage) C # is as follows;


    private void Button_Click(object sender, RoutedEventArgs e)
        { this.NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.Relative));
        }


Interface One (PAGE1) is as follows;






Interface II (PAGE2) is as follows;






As for the Page1,page2 code is not written out, because its code is similar to the code in the main interface Hyperlinkbutton, you can refer to the red and bold part of the mainpage;



Page navigation for "Windows Phone Development Learning notes"


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.