此示例演示从 NavigationWindow 定位到页的几种方法。
示例
可以使用以下方法之一从 NavigationWindow 定位到页:
' Navigate to URI using the Source property
Me.Source = New Uri("HomePage.xaml", UriKind.Relative)
' Navigate to URI using the Navigate method
Me.Navigate(New Uri("HomePage.xaml", UriKind.Relative))
' Navigate to object using the Navigate method
Me.Navigate(New HomePage())
// Navigate to URI using the Source property
this.Source = new Uri("HomePage.xaml", UriKind.Relative);
// Navigate to URI using the Navigate method
this.Navigate(new Uri("HomePage.xaml", UriKind.Relative));
// Navigate to object using the Navigate method
this.Navigate(new HomePage());
![]() |
---|
Uniform resource identifiers (URIs) 可以是相对的,也可以是绝对的。有关更多信息,请参见 WPF 中的 Pack URI。 |