vstocatelnavigationservice

NavigationService null in VSTO, CATEL


I'm developing a VSTO application, using the Catel framework. Trying to create user interfaces primarily from TaskPane, not Window. Therefore, my only usable control is User Control. Encountered the following issue when trying to navigate to another view, where I encountered NullReference issue at Catel.Services.NavigationService.NavigateWithParameters(String uri, Dictionary2 parameters)`. When checked, the RootFrame is null.

Is null RootFrame is the culprit? Understandably, navigation is triggered from Frame and when checked to Catel's source, the RootFrame is always derived from Window.Current. But I'm not so sure in the context of TaskPane.

Any alternative/workarounds? Thank you.

Detailed error message

System.NullReferenceException was unhandled by user code
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Catel.MVVM
  StackTrace:
       at Catel.Services.NavigationService.NavigateWithParameters(String uri, Dictionary parameters) in c:\CI_WS\Ws\5063\Source\Catel\src\Catel.MVVM\Catel.MVVM.Shared\Services\NavigationService.xaml.cs:line 180
       at Catel.Services.NavigationService.Navigate(String uri, Dictionary parameters) in c:\CI_WS\Ws\5063\Source\Catel\src\Catel.MVVM\Catel.MVVM.Shared\Services\NavigationService.cs:line 120

Solution

  • The NavigationService in Catel is used for page based applications (very old WPF navigation, Silverlight navigation and phone navigation). If you want to use other navigation services, write your own one or use the IUIVisualizerService.