c# - INavigationService as MainPage constructor argument -


i have basic prism/unity/xamarin forms app prism templates.

if change following (add parameter) fails

public mainpage(inavigationservice navigationservice) {     initializecomponent(); } 

container works getting navigation service way causes mainpage not found.

is there better way contentpage navigation service button click can navigate new page?

i have tried register navigation service oninitialized have found in samples , compile error now.

using following packages/versions:

  • prism.unity.forms 6.2.0.pre4
  • prism.forms 6.1.0.pre4
  • xamarin.forms 2.2.0.45
  • unity 4.0.1
  • windows 10 uwp

prism framework create apps using mvvm. if go read on mvvm , practices used, you'll notice code behind in page should kept minimal , logic moved viewmodel.

applying code, should not add inavigationservice page, navigation should done viewmodel.

now hear asking: "but how click viewmodel?". that's done using command.

<button text="navigate speak page" command="{binding navigatetospeakpagecommand}" /> 

i suggest have @ documentation , samples on prism repository: