I'm using modern ui wpf and trying to navigate from CheckLogin.xaml page to MainWindow.xaml page (they are in solution root directory). From inside CheckLogin.xaml I wrote this:
BBCodeBlock bbBlock = new BBCodeBlock();
bbBlock.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this);
I used the following values for url: "/MainWindow.xaml", "pack://application:/MainWindow.xaml",
but an exception thrown "Unable to navigate to pack://application:/MainWindow.xaml, could not find a ModernFrame target ''".
what I'm missing, and how to navigate correctly?
Using NavigationService
To use navigation service to navigate between pages
Alternative approach
Using uri
Using object
these both approach will achieve the navigation too. above sample will only work when you are using them from the child of NavigationWindow i.e. CheckLogin.xaml in this case. alternatively you may find the appropriate parent by some helper functions.
Eg.
Using LinkNavigator
you may need to specify the frame target
following options can be specified for frame target