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

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229