Modern UI how to go to another page from another link

后端 未结 2 1626
不知归路
不知归路 2021-01-07 03:16

I am currently using Modern UI from CodePlex. It is great and easy to use but there are some classes and events that I am not familiar with. Example: I have two GroupLinks n

相关标签:
2条回答
  • 2021-01-07 03:41

    For anyone that may be struggling with this, set this in your MainWindow.cs constructor:

            Application.Current.MainWindow = this;
    

    Then in the part of your application where you want to navigate to a page, run this:

            IInputElement target = NavigationHelper.FindFrame("_top", Application.Current.MainWindow);
            NavigationCommands.GoToPage.Execute("/NameOfYourPage.xaml", target);
    
    0 讨论(0)
  • 2021-01-07 03:59

    You are mixing "page" navigation with "tab" navigation inside the ModernTab control.

    If you call NavigationCommands.GoToPage.Execute inside a ModernTab control you are changing the current "tab", not the current "page".

    To change the top level page you can use:

    IInputElement target = NavigationHelper.FindFrame("_top", this);
    NavigationCommands.GoToPage.Execute("/Pages/BasicPage1.xaml", target);
    

    If the new page is another ModernTab and you want to select a different tab then the default one, then you have to put in place some extra code. In example you could pass parameters to the new page. Se this SO answer.

    0 讨论(0)
提交回复
热议问题