如何随机导航到10页请帮助我是初学者! [英] How to navigate to 10 pages randomly pls help am a beginner !!!

查看:173
本文介绍了如何随机导航到10页请帮助我是初学者!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何随机导航到10页请帮助我是初学者!  

解决方案


如果你想导航到10页,那么也许你可以参考以下代码,一旦您在文本框中输入页面名称,然后单击该按钮,您将导航到所需的页面。


在MainPage.xaml中:

< Grid x:Name =" ContentPanel" Grid.Row = QUOT 1 QUOT;余量= QUOT; 12,0,12,0"> 
< TextBox Name =" PageNamebox"的Horizo​​ntalAlignment = QUOT;左"高度= QUOT; 72"余量= QUOT; -10,114,0,0" TextWrapping = QUOT;包覆与QUOT; VerticalAlignment = QUOT;陀螺"宽度= QUOT; 456" />
< TextBlock Horizo​​ntalAlignment =" Left"余量= QUOT; 0,66,-10,0" TextWrapping = QUOT;包覆与QUOT; Text ="输入您要导航到的页面名称:" VerticalAlignment = QUOT;陀螺"高度= QUOT; 48英寸;宽度= QUOT; 466" />
< Button Horizo​​ntalAlignment =" Left"余量= QUOT; 51,261,0,0" VerticalAlignment = QUOT;陀螺"含量=" GO"高度= QUOT; 122"宽度= QUOT; 313"点击= QUOT; Button_Click" />
< / Grid>


在MainPage.xaml.cs中:

 private void Button_Click(对象发送者) ,RoutedEventArgs e)
{
this.NavigationService.Navigate(new Uri(" /"+ this.PageNamebox.Text +" .xaml",UriKind.Relative));
}




谢谢。


How to navigate to 10 pages randomly pls help am a beginner !!!  

解决方案

Hi,

If you want to navigate to 10 pages, then maybe you can refer to the following code, once you enter the page name in the textbox, and click the button, then you will navigate to the page which you want.

In the MainPage.xaml:

  <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <TextBox Name="PageNamebox" HorizontalAlignment="Left" Height="72" Margin="-10,114,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="456"/>
            <TextBlock HorizontalAlignment="Left" Margin="0,66,-10,0" TextWrapping="Wrap" Text="Enter the Page Name that you want to navigate to:" VerticalAlignment="Top" Height="48" Width="466"/>
            <Button HorizontalAlignment="Left" Margin="51,261,0,0" VerticalAlignment="Top" Content="Go" Height="122" Width="313" Click="Button_Click"/>
  </Grid>

In the MainPage.xaml.cs:

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


Thanks.


这篇关于如何随机导航到10页请帮助我是初学者!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆