I am trying to navigate via code-behind in my WinUI3 desktop application. I have found this article that explains how to do it. https://xamlbrewer.wordpress.com/2021/07/06/navigating-in-a-winui-3-desktop-application/
The author of the article has this section:
*Then we exposed the implementation via the App instance – it knows the Shell because it creates it on start-up:
private Shell shell;
public INavigation Navigation => shell;
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
shell = new Shell();
shell.Activate();
}*
I mainly understand all of the setup that will be required to navigate via code-behind, but I did not understand that one line of code "public INavigation Navigation => shell;"
My code, where I will insert similar code once I build the interface, etc., looks like this:
namespace MetricReporting
{
public partial class App : Application
{
public App()
{
this.InitializeComponent();
}
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}
private Window m_window;
}
}
That code line in question should be "public INavigation Navigation => m_window;" (This is my understanding) to work with my application.
I appreciate anyone who can explain what this line is doing. Sincerely.