zoukankan      html  css  js  c++  java
  • Using the NavigationService Object in SL4.0

    1 Begin by opening the project NavAppFromScratch you just completed in previous session.

    2. open the xmal file for View1.xaml and modify the source to include a button under the TextBlock.

    <Grid x:Name="LayoutRoot">

      <StackPanel>

        <TextBlock Text = "View 1" FontSize="60" Foreground="Green" HorizontalAlignment = "Center" VerticalAlignment="Center" />

        <Button Click="Button_Click" Padding="10" Content="Navigate to Inner View" HorizontalAlignment="Center" />

      </StackPanel>

    </Grid>

    3. You now need to add the new view that you will navigate to use the NavigationService. Right Click on the SL project and choose Add->New item. Select SL Page as the template and name the file InnerView1.xmal.

    4. In the XAL for InnerView1.xmal, add a simple TextBlock.

    <Grid x:Name="LayoutRoot">

      <TextBlock Text="InnerView 1" FontSize="40" Foreground="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" />

    </Grid>

    5. Next, add the Button_Click event handler in the View1.xmal code behid and add the following code:

    private void Button_Click(Object sender, RoutedEventArgs e)

    {

      NavigationService.Navigate(new Uri ("/InnerView1.xaml", UriKind.Relative));

    }

    6. Press F5 to run the application.

  • 相关阅读:
    C# 五子棋_GDI+实现
    SAE python+chrome扩展快速存储喜欢的图片(可做图床)
    C# 生成迷宫及寻路
    解决 yii2 从数据库查出来的数据都变成了字符串格式
    英语词根3
    “诸葛马前课-小六壬”全面解析
    Ubuntu 尝试
    ListView + ToolTip 的問題
    英语词根 1
    英语词根6
  • 原文地址:https://www.cnblogs.com/jerrychenfly/p/2140506.html
Copyright © 2011-2022 走看看