Navigating to a view in a different project

Topics: Questions
Sep 26, 2013 at 10:08 AM
Hi Everyone.

I'm having an issue navigating from my "HomeView.xaml" to a view which is in another project in the solution.

I've tried using the ViewLocator and the ViewModelLocator but the view that appears when the tile is clicked is empty.

Does anyone have an example of how I can navigate to a view in a separate project?

Regards,
Devon Britton.
Sep 26, 2013 at 10:08 PM
Edited Sep 26, 2013 at 10:09 PM
Did you try to put a breakpoint on the constructor or enable the logging? If you enable the logging, Catel will show you what's happening under the hood. In your startup, do this:
#if DEBUG
    LogManager.RegisterDebugListener();
#endif
Sep 27, 2013 at 10:36 AM
Edited Sep 27, 2013 at 10:36 AM
Hi Geert.

I'm not sure how but it seems to be working now.

I have, unfortunately, run into another issue regarding the NavigationService.

I'm trying to navigate to a new page from a viewmodel using the Navigation Service.

I'm getting a NullReferenceException because navigationService.canGoBack and navigationService.canGoForward are both null.

If I try set their values I get the error saying they have no setters...

Kind Regards,
Devon Britton
Sep 27, 2013 at 10:40 AM
What kind of project are you building. WPF, SL, WP or WinRT?
Sep 27, 2013 at 10:47 AM
Edited Sep 27, 2013 at 10:50 AM
It's a WPF project.

Here's my code snippet of the command...
#region Add command

            private Command _addCommand;

            /// <summary>
            /// Gets the Add command.
            /// </summary>
            public Command AddCommand
            {
                get { return _addCommand ?? (_addCommand = new Command(Add)); }
            }

            /// <summary>
            /// Method to invoke when the Add command is executed.
            /// </summary>
            private void Add()
            {
                var navigationService = GetService<INavigationService>();
                
                navigationService.Navigate<AddressBookDetailItemViewModel>();
            }

            #endregion
Sep 27, 2013 at 10:51 AM
Then you are probably not looking for the NavigationService, but the UIVisualizerService (to show windows).
Sep 27, 2013 at 10:53 AM
Well basically when I click the button it must navigate to a new view and it's associated viewmodel.
Sep 27, 2013 at 12:33 PM
If you want to show a window, you should use the UIVisualizerService. I am not sure what other navigation you mean.