I'm trying to go to another page when clicking a button. How could i do this.
I tried using a NavigationViewItem
but it didn't work.
I'm trying to go to another page when clicking a button. How could i do this.
I tried using a NavigationViewItem
but it didn't work.
The NavigationViewItem
you posted is used in UWP.
If it is a WinUI3 project, then you need to refer to this document, use Navigate
.
the relevant code samples are as follows.
xaml
<Button x:Name="myButton" Click="myButton_Click"/>
xaml.cs
private void myButton_Click(object sender, RoutedEventArgs e)
{
Frame rootFrame = new Frame();
this.Content = rootFrame;
rootFrame.Navigate(typeof(BlankPage1), null);
}