简体   繁体   中英

How navigate from one page to another?

Currently I am working on a xaml page with several buttons that are going to link to other xaml pages, but I cannot figure out how to navigate from one xaml page to another. This is what I currently have.

Private Sub GoTools(sender As Object, e As MouseButtonEventArgs)
    MainFrame.Navigate(New Uri("Tools.xaml"))
End Sub

This is what I have seen on a lot of websites so far but this does not work, how should I change this so that when I click a Tools button it brings me to the Tools page? (Quotes have been changed)

When I run the program and click the button I get this error

An unhandled exception of type 'System.UriFormatException' occurred in System.dll

Additional information: Invalid URI: The format of the URI could not be determined.`

How about you do it this way:

Private Sub GoTools(sender As Object, e As MouseButtonEventArgs)
  MainFrame.Navigate(New Tool)
End Sub

I am not familiar with VB, but you have to create an instance of your Tool page. In case you already have one just navigate to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM