Navigation.Navigate-WPF [英] Navigation.Navigate - wpf

查看:305
本文介绍了Navigation.Navigate-WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我是wpf的新手
我尝试使用NavigationWindows创建应用程序

1.在我的项目中,我创建一个名为"dir1"的目录,并在其中添加一个名为"Page1.xaml"的页面.

2.i在根目录中添加另一个名为"MainPage.xaml"的页面,并在其中单击以导航到目录"dir1"中的page1.xaml....

3.i将MainWindow.xaml文件更改为:

hi every body
i am new in wpf
i try to make an application with NavigationWindows

1.in my project i make a directory with name ''dir1'' and add a page that named ''Page1.xaml'' in it.

2.i add another page named ''MainPage.xaml'' in the root and put a button in it to click on it and navigate to page1.xaml in directory ''dir1''....

3.i changed my MainWindow.xaml file to :

<navigationwindow x:class="ShahrdariKashan.MainWindow" xmlns:x="#unknown">
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Source="MainPage.xaml"
                  FlowDirection="RightToLeft"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
    
</navigationwindow>




4.i像下面这样更改我的app.xaml文件:




4.i change my app.xaml file like bellow:

<application x:class="ShahrdariKashan.App" xmlns:x="#unknown">
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <application.resources>
         
    </application.resources>
</application>



在按钮的点击事件中,我写了;



in the button''s click event i write ;

NavigationService.Navigate("/dir1/Page1.xaml");



但没有工作,
请帮助我;
谢谢alot



but no work ,
please help me;
thanks alot

推荐答案

参阅此:
http://msdn.microsoft.com/en-us/library/ms750478.aspx#NavigationService [^ ]
Refer to this:
http://msdn.microsoft.com/en-us/library/ms750478.aspx#NavigationService[^]


这篇关于Navigation.Navigate-WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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