Why, replacing DelegateCommand with Command is not working in Prism The Next CEO of Stack OverflowBinding error using ApplicationBarButtonCommand and DelegateCommandHow to call RaiseCanExecuteChanged for all DelegateCommand and DelegateCommand<T> in base ViewModel ClassHow to Unit Test DelegateCommand that calls async methods in MVVMPrism 5 - MVVM FrameworkICommandSource and DelegateCommandDelegateCommand from Prism doesn't fireHow to pass EventArgs to DelegateCommand?Routed Command Implementation in WPFHow to Bind SearchBar's TextChanged Trigger to Command using EventToCommand Behavior in Xamarin.Forms using Prism?Xamarin Forms bind a command in a custom controler with Prism

Do I need to enable Dev Hub in my PROD Org?

Novel about a guy who is possessed by the divine essence and the world ends?

How to count occurrences of text in a file?

Sending manuscript to multiple publishers

What flight has the highest ratio of time difference to flight time?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Why do professional authors make "consistency" mistakes? And how to avoid them?

Limits on contract work without pre-agreed price/contract (UK)

How to transpose the 1st and -1th levels of arbitrarily nested array?

Why don't programming languages automatically manage the synchronous/asynchronous problem?

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

Written every which way

Bold, vivid family

Extending anchors in TikZ

Why am I allowed to create multiple unique pointers from a single object?

Why do airplanes bank sharply to the right after air-to-air refueling?

Would a galaxy be visible from outside, but nearby?

Is there a way to save my career from absolute disaster?

How does the mv command work with external drives?

Elegant way to replace substring in a regex with optional groups in Python?

If a black hole is created from light, can this black hole then move at speed of light?

What was the first Unix version to run on a microcomputer?

How to solve a differential equation with a term to a power?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?



Why, replacing DelegateCommand with Command is not working in Prism



The Next CEO of Stack OverflowBinding error using ApplicationBarButtonCommand and DelegateCommandHow to call RaiseCanExecuteChanged for all DelegateCommand and DelegateCommand<T> in base ViewModel ClassHow to Unit Test DelegateCommand that calls async methods in MVVMPrism 5 - MVVM FrameworkICommandSource and DelegateCommandDelegateCommand from Prism doesn't fireHow to pass EventArgs to DelegateCommand?Routed Command Implementation in WPFHow to Bind SearchBar's TextChanged Trigger to Command using EventToCommand Behavior in Xamarin.Forms using Prism?Xamarin Forms bind a command in a custom controler with Prism










0















In Prism Mvvm, Prism.Unity library, when I replace DelegateCommand with Binding Mvvm Command. It is not working. This is my working code



public class MainPageViewModel : BindableBase

private DelegateCommand _navigationCommand;

private INavigationService _navigationService;
public DelegateCommand NavigateCommand => _navigationCommand ?? (_navigationCommand = new DelegateCommand(ExecuteCommand));

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");




Now I make changes in DeletegateCommand, Command not getting fire. This is my modified code



public class MainPageViewModel : BindableBase

public ICommand _navigationCommand private set; get;
private INavigationService _navigationService;

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;
_navigationCommand = new Command(() => ExecuteCommand());

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");











share|improve this question
























  • Use Prism.Forms it is best framework for MVVM

    – K K
    Mar 8 at 14:23











  • Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

    – Haukinger
    Mar 8 at 15:45












  • @Haukinger - Thank you for your input. I had wrong command implementation.

    – CGPA6.4
    Mar 11 at 5:30
















0















In Prism Mvvm, Prism.Unity library, when I replace DelegateCommand with Binding Mvvm Command. It is not working. This is my working code



public class MainPageViewModel : BindableBase

private DelegateCommand _navigationCommand;

private INavigationService _navigationService;
public DelegateCommand NavigateCommand => _navigationCommand ?? (_navigationCommand = new DelegateCommand(ExecuteCommand));

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");




Now I make changes in DeletegateCommand, Command not getting fire. This is my modified code



public class MainPageViewModel : BindableBase

public ICommand _navigationCommand private set; get;
private INavigationService _navigationService;

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;
_navigationCommand = new Command(() => ExecuteCommand());

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");











share|improve this question
























  • Use Prism.Forms it is best framework for MVVM

    – K K
    Mar 8 at 14:23











  • Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

    – Haukinger
    Mar 8 at 15:45












  • @Haukinger - Thank you for your input. I had wrong command implementation.

    – CGPA6.4
    Mar 11 at 5:30














0












0








0








In Prism Mvvm, Prism.Unity library, when I replace DelegateCommand with Binding Mvvm Command. It is not working. This is my working code



public class MainPageViewModel : BindableBase

private DelegateCommand _navigationCommand;

private INavigationService _navigationService;
public DelegateCommand NavigateCommand => _navigationCommand ?? (_navigationCommand = new DelegateCommand(ExecuteCommand));

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");




Now I make changes in DeletegateCommand, Command not getting fire. This is my modified code



public class MainPageViewModel : BindableBase

public ICommand _navigationCommand private set; get;
private INavigationService _navigationService;

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;
_navigationCommand = new Command(() => ExecuteCommand());

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");











share|improve this question
















In Prism Mvvm, Prism.Unity library, when I replace DelegateCommand with Binding Mvvm Command. It is not working. This is my working code



public class MainPageViewModel : BindableBase

private DelegateCommand _navigationCommand;

private INavigationService _navigationService;
public DelegateCommand NavigateCommand => _navigationCommand ?? (_navigationCommand = new DelegateCommand(ExecuteCommand));

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");




Now I make changes in DeletegateCommand, Command not getting fire. This is my modified code



public class MainPageViewModel : BindableBase

public ICommand _navigationCommand private set; get;
private INavigationService _navigationService;

public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;
_navigationCommand = new Command(() => ExecuteCommand());

void ExecuteCommand()

_navigationService.NavigateAsync("SecondPage");








c# xamarin mvvm xamarin.forms prism






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 12:24







CGPA6.4

















asked Mar 8 at 14:05









CGPA6.4CGPA6.4

2,91031132




2,91031132












  • Use Prism.Forms it is best framework for MVVM

    – K K
    Mar 8 at 14:23











  • Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

    – Haukinger
    Mar 8 at 15:45












  • @Haukinger - Thank you for your input. I had wrong command implementation.

    – CGPA6.4
    Mar 11 at 5:30


















  • Use Prism.Forms it is best framework for MVVM

    – K K
    Mar 8 at 14:23











  • Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

    – Haukinger
    Mar 8 at 15:45












  • @Haukinger - Thank you for your input. I had wrong command implementation.

    – CGPA6.4
    Mar 11 at 5:30

















Use Prism.Forms it is best framework for MVVM

– K K
Mar 8 at 14:23





Use Prism.Forms it is best framework for MVVM

– K K
Mar 8 at 14:23













Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

– Haukinger
Mar 8 at 15:45






Can you point us to the Command implementation? Side note: why do you want to not use DelegateCommand?

– Haukinger
Mar 8 at 15:45














@Haukinger - Thank you for your input. I had wrong command implementation.

– CGPA6.4
Mar 11 at 5:30






@Haukinger - Thank you for your input. I had wrong command implementation.

– CGPA6.4
Mar 11 at 5:30













2 Answers
2






active

oldest

votes


















0














Well I am not completely sure that this could be the reason but I think your code should look something like this:



public ICommand NavigationCommand set; get; 


Then set it in the constructor:



 public MainPageViewModel(INavigationService navigationService)

_navigationService = navigationService;
NavigationCommand = new Command(ExecuteCommand);



And your method would look something like below:



private void ExecuteCommand(object obj) 

_navigationService.NavigateAsync("SecondPage");



use object obj if you want to pass any data as Command Parameter






share|improve this answer























  • Why should the command have a public setter?

    – Haukinger
    Mar 11 at 8:29











  • @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

    – G.hakim
    Mar 11 at 8:49












  • name one that is not a violation of separation of concerns or feature envy

    – Haukinger
    Mar 11 at 9:47











  • @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

    – G.hakim
    Mar 11 at 10:13



















0














I implement command wrong in XAML due to that I was facing this issue.



Thank you.






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%2f55064882%2fwhy-replacing-delegatecommand-with-command-is-not-working-in-prism%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









    0














    Well I am not completely sure that this could be the reason but I think your code should look something like this:



    public ICommand NavigationCommand set; get; 


    Then set it in the constructor:



     public MainPageViewModel(INavigationService navigationService)

    _navigationService = navigationService;
    NavigationCommand = new Command(ExecuteCommand);



    And your method would look something like below:



    private void ExecuteCommand(object obj) 

    _navigationService.NavigateAsync("SecondPage");



    use object obj if you want to pass any data as Command Parameter






    share|improve this answer























    • Why should the command have a public setter?

      – Haukinger
      Mar 11 at 8:29











    • @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

      – G.hakim
      Mar 11 at 8:49












    • name one that is not a violation of separation of concerns or feature envy

      – Haukinger
      Mar 11 at 9:47











    • @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

      – G.hakim
      Mar 11 at 10:13
















    0














    Well I am not completely sure that this could be the reason but I think your code should look something like this:



    public ICommand NavigationCommand set; get; 


    Then set it in the constructor:



     public MainPageViewModel(INavigationService navigationService)

    _navigationService = navigationService;
    NavigationCommand = new Command(ExecuteCommand);



    And your method would look something like below:



    private void ExecuteCommand(object obj) 

    _navigationService.NavigateAsync("SecondPage");



    use object obj if you want to pass any data as Command Parameter






    share|improve this answer























    • Why should the command have a public setter?

      – Haukinger
      Mar 11 at 8:29











    • @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

      – G.hakim
      Mar 11 at 8:49












    • name one that is not a violation of separation of concerns or feature envy

      – Haukinger
      Mar 11 at 9:47











    • @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

      – G.hakim
      Mar 11 at 10:13














    0












    0








    0







    Well I am not completely sure that this could be the reason but I think your code should look something like this:



    public ICommand NavigationCommand set; get; 


    Then set it in the constructor:



     public MainPageViewModel(INavigationService navigationService)

    _navigationService = navigationService;
    NavigationCommand = new Command(ExecuteCommand);



    And your method would look something like below:



    private void ExecuteCommand(object obj) 

    _navigationService.NavigateAsync("SecondPage");



    use object obj if you want to pass any data as Command Parameter






    share|improve this answer













    Well I am not completely sure that this could be the reason but I think your code should look something like this:



    public ICommand NavigationCommand set; get; 


    Then set it in the constructor:



     public MainPageViewModel(INavigationService navigationService)

    _navigationService = navigationService;
    NavigationCommand = new Command(ExecuteCommand);



    And your method would look something like below:



    private void ExecuteCommand(object obj) 

    _navigationService.NavigateAsync("SecondPage");



    use object obj if you want to pass any data as Command Parameter







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 8 at 18:50









    G.hakimG.hakim

    5,02411136




    5,02411136












    • Why should the command have a public setter?

      – Haukinger
      Mar 11 at 8:29











    • @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

      – G.hakim
      Mar 11 at 8:49












    • name one that is not a violation of separation of concerns or feature envy

      – Haukinger
      Mar 11 at 9:47











    • @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

      – G.hakim
      Mar 11 at 10:13


















    • Why should the command have a public setter?

      – Haukinger
      Mar 11 at 8:29











    • @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

      – G.hakim
      Mar 11 at 8:49












    • name one that is not a violation of separation of concerns or feature envy

      – Haukinger
      Mar 11 at 9:47











    • @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

      – G.hakim
      Mar 11 at 10:13

















    Why should the command have a public setter?

    – Haukinger
    Mar 11 at 8:29





    Why should the command have a public setter?

    – Haukinger
    Mar 11 at 8:29













    @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

    – G.hakim
    Mar 11 at 8:49






    @Haukinger Make it private it doesn't matter, but there are scenarios where people want to access it publicly! I anyways never said that it should not be private now did I?

    – G.hakim
    Mar 11 at 8:49














    name one that is not a violation of separation of concerns or feature envy

    – Haukinger
    Mar 11 at 9:47





    name one that is not a violation of separation of concerns or feature envy

    – Haukinger
    Mar 11 at 9:47













    @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

    – G.hakim
    Mar 11 at 10:13






    @Haukinger I actually agree with you on this but don't you think in that case removing the set part all together would be the best solution in that way there won't be a violation there

    – G.hakim
    Mar 11 at 10:13














    0














    I implement command wrong in XAML due to that I was facing this issue.



    Thank you.






    share|improve this answer



























      0














      I implement command wrong in XAML due to that I was facing this issue.



      Thank you.






      share|improve this answer

























        0












        0








        0







        I implement command wrong in XAML due to that I was facing this issue.



        Thank you.






        share|improve this answer













        I implement command wrong in XAML due to that I was facing this issue.



        Thank you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 12 at 11:30









        CGPA6.4CGPA6.4

        2,91031132




        2,91031132



























            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%2f55064882%2fwhy-replacing-delegatecommand-with-command-is-not-working-in-prism%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

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page