如何导航到一个页面

此示例说明了从 NavigationWindow 导航到页面的几种方法。

示例:

NavigationWindow 可以使用以下方法之一导航到页面:

// 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());
' 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())

注释

统一资源标识符(URI)可以是相对标识符或绝对标识符。 有关详细信息,请参阅 WPF 中的 Pack URI

另请参阅