Need to overide the navigation methodMultiple navigation control through dependency injectionCreate Generic method constraining T to an EnumHow do I use reflection to call a generic method?Why is it important to override GetHashCode when Equals method is overridden?How to mark a method as obsolete or deprecated?MEF part unable to import Autofac autogenerated factoryIs it possible to catch an exception you can't handle (in C#)?How to call asynchronous method from synchronous method in C#?Populate initial view model data using caliburn micro and autofacAutofac multithreading issuesPassing a selected item of listbox into a xaml

Taking advantage when HR forgets to communicate the rules

Intern not wearing safety equipment; how could I have handled this differently?

Need a non-volatile memory IC with near unlimited read/write operations capability

Chilling juice in copper vessel

How should I ask for a "pint" in countries that use metric?

Floating Pumice Road. Slab Size

Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?

How do resistors generate different heat if we make the current fixed and changed the voltage and resistance? Notice the flow of charge is constant

Did William Shakespeare hide things in his writings?

NOLOCK or Read Uncommitted locking / latching behaviours

Why do airports remove/realign runways?

Users forgotting to regenerate PDF before sending it

What are some bad ways to subvert tropes?

Taking my Ph.D. advisor out for dinner after graduation

What exactly is a "murder hobo"?

Possibility to correct pitch from digital versions of records with the hole not centered

How to evaluate the performance of open source solver?

How to have a filled pattern

How did the Time Lords put a whole "Star" in a Tardis?

Why did the frequency of the word "черт" (devil) in books increase by a few times since the October Revolution?

What factors could lead to bishops establishing monastic armies?

Why is whale hunting treated differently from hunting other animals?

Computer name naming convention for security

I don't want to be introduced as a "Minority Novelist"



Need to overide the navigation method


Multiple navigation control through dependency injectionCreate Generic method constraining T to an EnumHow do I use reflection to call a generic method?Why is it important to override GetHashCode when Equals method is overridden?How to mark a method as obsolete or deprecated?MEF part unable to import Autofac autogenerated factoryIs it possible to catch an exception you can't handle (in C#)?How to call asynchronous method from synchronous method in C#?Populate initial view model data using caliburn micro and autofacAutofac multithreading issuesPassing a selected item of listbox into a xaml






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am using autofac for dependency injection and I need to override the navigation function. in order to do that I did



Locator.cs(where contain the Cs files)



 private readonly ContainerBuilder _builder;

public locator()

_builder = new ContainerBuilder();
register();
Container = _builder.Build();


public IContainer Container get; set;

private void register()

_builder.RegisterType<vm>().As<Ivm>();
_builder.RegisterType<Vm1>();
_builder.RegisterType < basevm>();

_builder.RegisterType<MainPage>();
_builder.RegisterType<xa>();



In my app.Xaml.cs



In constructor



 public App()

InitializeComponent();
locator locator1 = new locator();
Container = locator1.Container;

MainPage = new NavigationPage(Container.Resolve<MainPage>());

public static IContainer Container;


then I tried to override the navigation func in my main page code behind it cannot be override. what I am missing and where i use this



 public abstract void Navigate(SelectedItemChangedEventArgs e);

public override async void Navigate(SelectedItemChangedEventArgs e)

xa patientListViewPage = App.Container.Resolve<xa>();

await Navigation.PushAsync(patientListViewPage);



why this is not working. I occur this error



'MainPage.Navigate(SelectedItemChangedEventArgs)': no suitable method found to override










share|improve this question






















  • What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

    – Rudi Visser
    Mar 21 at 22:04











  • I don't need to any framework. in this case I need to create my own navigation system using di can it possible

    – ish1104
    Mar 22 at 3:23











  • I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

    – Rudi Visser
    Mar 22 at 9:59

















1















I am using autofac for dependency injection and I need to override the navigation function. in order to do that I did



Locator.cs(where contain the Cs files)



 private readonly ContainerBuilder _builder;

public locator()

_builder = new ContainerBuilder();
register();
Container = _builder.Build();


public IContainer Container get; set;

private void register()

_builder.RegisterType<vm>().As<Ivm>();
_builder.RegisterType<Vm1>();
_builder.RegisterType < basevm>();

_builder.RegisterType<MainPage>();
_builder.RegisterType<xa>();



In my app.Xaml.cs



In constructor



 public App()

InitializeComponent();
locator locator1 = new locator();
Container = locator1.Container;

MainPage = new NavigationPage(Container.Resolve<MainPage>());

public static IContainer Container;


then I tried to override the navigation func in my main page code behind it cannot be override. what I am missing and where i use this



 public abstract void Navigate(SelectedItemChangedEventArgs e);

public override async void Navigate(SelectedItemChangedEventArgs e)

xa patientListViewPage = App.Container.Resolve<xa>();

await Navigation.PushAsync(patientListViewPage);



why this is not working. I occur this error



'MainPage.Navigate(SelectedItemChangedEventArgs)': no suitable method found to override










share|improve this question






















  • What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

    – Rudi Visser
    Mar 21 at 22:04











  • I don't need to any framework. in this case I need to create my own navigation system using di can it possible

    – ish1104
    Mar 22 at 3:23











  • I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

    – Rudi Visser
    Mar 22 at 9:59













1












1








1








I am using autofac for dependency injection and I need to override the navigation function. in order to do that I did



Locator.cs(where contain the Cs files)



 private readonly ContainerBuilder _builder;

public locator()

_builder = new ContainerBuilder();
register();
Container = _builder.Build();


public IContainer Container get; set;

private void register()

_builder.RegisterType<vm>().As<Ivm>();
_builder.RegisterType<Vm1>();
_builder.RegisterType < basevm>();

_builder.RegisterType<MainPage>();
_builder.RegisterType<xa>();



In my app.Xaml.cs



In constructor



 public App()

InitializeComponent();
locator locator1 = new locator();
Container = locator1.Container;

MainPage = new NavigationPage(Container.Resolve<MainPage>());

public static IContainer Container;


then I tried to override the navigation func in my main page code behind it cannot be override. what I am missing and where i use this



 public abstract void Navigate(SelectedItemChangedEventArgs e);

public override async void Navigate(SelectedItemChangedEventArgs e)

xa patientListViewPage = App.Container.Resolve<xa>();

await Navigation.PushAsync(patientListViewPage);



why this is not working. I occur this error



'MainPage.Navigate(SelectedItemChangedEventArgs)': no suitable method found to override










share|improve this question














I am using autofac for dependency injection and I need to override the navigation function. in order to do that I did



Locator.cs(where contain the Cs files)



 private readonly ContainerBuilder _builder;

public locator()

_builder = new ContainerBuilder();
register();
Container = _builder.Build();


public IContainer Container get; set;

private void register()

_builder.RegisterType<vm>().As<Ivm>();
_builder.RegisterType<Vm1>();
_builder.RegisterType < basevm>();

_builder.RegisterType<MainPage>();
_builder.RegisterType<xa>();



In my app.Xaml.cs



In constructor



 public App()

InitializeComponent();
locator locator1 = new locator();
Container = locator1.Container;

MainPage = new NavigationPage(Container.Resolve<MainPage>());

public static IContainer Container;


then I tried to override the navigation func in my main page code behind it cannot be override. what I am missing and where i use this



 public abstract void Navigate(SelectedItemChangedEventArgs e);

public override async void Navigate(SelectedItemChangedEventArgs e)

xa patientListViewPage = App.Container.Resolve<xa>();

await Navigation.PushAsync(patientListViewPage);



why this is not working. I occur this error



'MainPage.Navigate(SelectedItemChangedEventArgs)': no suitable method found to override







c# mvvm xamarin.forms autofac






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 12:02









ish1104ish1104

1471 silver badge15 bronze badges




1471 silver badge15 bronze badges












  • What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

    – Rudi Visser
    Mar 21 at 22:04











  • I don't need to any framework. in this case I need to create my own navigation system using di can it possible

    – ish1104
    Mar 22 at 3:23











  • I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

    – Rudi Visser
    Mar 22 at 9:59

















  • What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

    – Rudi Visser
    Mar 21 at 22:04











  • I don't need to any framework. in this case I need to create my own navigation system using di can it possible

    – ish1104
    Mar 22 at 3:23











  • I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

    – Rudi Visser
    Mar 22 at 9:59
















What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

– Rudi Visser
Mar 21 at 22:04





What are you trying to achieve here? Most apps would introduce a service dedicated to navigation, that would wire in your DI that way rather than hacking the NavigationPage's Navigation itself.

– Rudi Visser
Mar 21 at 22:04













I don't need to any framework. in this case I need to create my own navigation system using di can it possible

– ish1104
Mar 22 at 3:23





I don't need to any framework. in this case I need to create my own navigation system using di can it possible

– ish1104
Mar 22 at 3:23













I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

– Rudi Visser
Mar 22 at 9:59





I'm not suggesting a framework, I'm suggesting a service dedicated to navigation, rather than calling straight onto the Navigation object itself. Take a look at Enterprise App Navigation from Microsoft that should describe better what I'm suggesting.

– Rudi Visser
Mar 22 at 9:59












2 Answers
2






active

oldest

votes


















1















You can derive from NavigationPage reference.




public class CustomNavigationPage : NavigationPage

//You can define your container here.
public CustomNavigationPage()

//You can resolve here





and also you can look
here







share|improve this answer






























    1














    I Can think of a better way You are using Autofac so you can have a generic method that can help the cause.



     public static async Task NavigateAsync<TContentPage>(INavigation navigation ) where TContentPage : ContentPage

    var contentPage = App.Container.Resolve<TContentPage>();

    await navigation.PushAsync(contentPage, true);



    Also If you need to pass a parameter You can modify it like this



     public static async Task NavigateAsync<TContentPage, TNavigationParameter>(INavigation navigation,
    TNavigationParameter navParam,
    Action<TContentPage, TNavigationParameter> action = null) where TContentPage : ContentPage

    var contentPage = App.Container.Resolve<TContentPage>();
    action?.Invoke(contentPage, navParam);
    await navigation.PushAsync(contentPage, true);






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280008%2fneed-to-overide-the-navigation-method%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1















      You can derive from NavigationPage reference.




      public class CustomNavigationPage : NavigationPage

      //You can define your container here.
      public CustomNavigationPage()

      //You can resolve here





      and also you can look
      here







      share|improve this answer



























        1















        You can derive from NavigationPage reference.




        public class CustomNavigationPage : NavigationPage

        //You can define your container here.
        public CustomNavigationPage()

        //You can resolve here





        and also you can look
        here







        share|improve this answer

























          1












          1








          1








          You can derive from NavigationPage reference.




          public class CustomNavigationPage : NavigationPage

          //You can define your container here.
          public CustomNavigationPage()

          //You can resolve here





          and also you can look
          here







          share|improve this answer














          You can derive from NavigationPage reference.




          public class CustomNavigationPage : NavigationPage

          //You can define your container here.
          public CustomNavigationPage()

          //You can resolve here





          and also you can look
          here








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 21:14









          BatuhanBatuhan

          3923 silver badges14 bronze badges




          3923 silver badges14 bronze badges























              1














              I Can think of a better way You are using Autofac so you can have a generic method that can help the cause.



               public static async Task NavigateAsync<TContentPage>(INavigation navigation ) where TContentPage : ContentPage

              var contentPage = App.Container.Resolve<TContentPage>();

              await navigation.PushAsync(contentPage, true);



              Also If you need to pass a parameter You can modify it like this



               public static async Task NavigateAsync<TContentPage, TNavigationParameter>(INavigation navigation,
              TNavigationParameter navParam,
              Action<TContentPage, TNavigationParameter> action = null) where TContentPage : ContentPage

              var contentPage = App.Container.Resolve<TContentPage>();
              action?.Invoke(contentPage, navParam);
              await navigation.PushAsync(contentPage, true);






              share|improve this answer



























                1














                I Can think of a better way You are using Autofac so you can have a generic method that can help the cause.



                 public static async Task NavigateAsync<TContentPage>(INavigation navigation ) where TContentPage : ContentPage

                var contentPage = App.Container.Resolve<TContentPage>();

                await navigation.PushAsync(contentPage, true);



                Also If you need to pass a parameter You can modify it like this



                 public static async Task NavigateAsync<TContentPage, TNavigationParameter>(INavigation navigation,
                TNavigationParameter navParam,
                Action<TContentPage, TNavigationParameter> action = null) where TContentPage : ContentPage

                var contentPage = App.Container.Resolve<TContentPage>();
                action?.Invoke(contentPage, navParam);
                await navigation.PushAsync(contentPage, true);






                share|improve this answer

























                  1












                  1








                  1







                  I Can think of a better way You are using Autofac so you can have a generic method that can help the cause.



                   public static async Task NavigateAsync<TContentPage>(INavigation navigation ) where TContentPage : ContentPage

                  var contentPage = App.Container.Resolve<TContentPage>();

                  await navigation.PushAsync(contentPage, true);



                  Also If you need to pass a parameter You can modify it like this



                   public static async Task NavigateAsync<TContentPage, TNavigationParameter>(INavigation navigation,
                  TNavigationParameter navParam,
                  Action<TContentPage, TNavigationParameter> action = null) where TContentPage : ContentPage

                  var contentPage = App.Container.Resolve<TContentPage>();
                  action?.Invoke(contentPage, navParam);
                  await navigation.PushAsync(contentPage, true);






                  share|improve this answer













                  I Can think of a better way You are using Autofac so you can have a generic method that can help the cause.



                   public static async Task NavigateAsync<TContentPage>(INavigation navigation ) where TContentPage : ContentPage

                  var contentPage = App.Container.Resolve<TContentPage>();

                  await navigation.PushAsync(contentPage, true);



                  Also If you need to pass a parameter You can modify it like this



                   public static async Task NavigateAsync<TContentPage, TNavigationParameter>(INavigation navigation,
                  TNavigationParameter navParam,
                  Action<TContentPage, TNavigationParameter> action = null) where TContentPage : ContentPage

                  var contentPage = App.Container.Resolve<TContentPage>();
                  action?.Invoke(contentPage, navParam);
                  await navigation.PushAsync(contentPage, true);







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 5 at 3:48









                  Ishara LakshithaIshara Lakshitha

                  1539 bronze badges




                  1539 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280008%2fneed-to-overide-the-navigation-method%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해