We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Prism Navigation Issue

Hi, 

I'm using SfSchedule in a POC Xamarin.Forms project using Prism.  I'm displaying schedule items in a Month view and when I tap on a cell I want to navigate away to another page using Prism's navigation service.  When I changed my code to inject the the INavigationService into the ViewModel constructor for the schedule page I got the following error:  Missing default constructor for 'ProductViewer.ViewModels.ScheduleViewModel' with File: SyncFusionSchedule.xaml line 16.

I assume syncefusion is expecting a default constructor which takes no parameters but how can I inject and use Prism navigation service here?

My Code: 
        public ScheduleViewModel(INavigationService naviagtionService)
            : base(naviagtionService)
        {
            Title = "";

            ScheduleCellTapped = new Command<CellTappedEventArgs>(CellTappedAsync);
          
            ...
        }

Thanks for any help.
Eddie.

3 Replies

RK Radoslaw Kubas September 5, 2019 07:33 PM UTC

var naviagtionService = PrismApplicationBase.Current.Container.Resolve<INavigationService>();


ED Eddie September 6, 2019 12:38 PM UTC

Thank you Radoslaw.


KA Karthikraja Arumugam Syncfusion Team September 6, 2019 02:16 PM UTC

Hi Eddie, 
 
Thank you for contacting Syncfusion support. 
 
Based on the shared information we checked your requirement of using Schedule with Prism NavigationService. As Radoslaw said you can achieve your requirement or we have prepared a sample to use Prism INavigationService in Schedule, you can refer the same to achieve your requirement. 
 
Sample link: SchedulePrism 
 
We hope this helps. Please let us know, if you need any further assistance. 
  
Regards,
Karthik Raja A 


Loader.
Live Chat Icon For mobile
Up arrow icon