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
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
add a comment |
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
Use Prism.Forms it is best framework for MVVM
– K K
Mar 8 at 14:23
Can you point us to theCommandimplementation? Side note: why do you want to not useDelegateCommand?
– Haukinger
Mar 8 at 15:45
@Haukinger - Thank you for your input. I had wrong command implementation.
– CGPA6.4
Mar 11 at 5:30
add a comment |
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
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
c# xamarin mvvm xamarin.forms prism
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 theCommandimplementation? Side note: why do you want to not useDelegateCommand?
– Haukinger
Mar 8 at 15:45
@Haukinger - Thank you for your input. I had wrong command implementation.
– CGPA6.4
Mar 11 at 5:30
add a comment |
Use Prism.Forms it is best framework for MVVM
– K K
Mar 8 at 14:23
Can you point us to theCommandimplementation? Side note: why do you want to not useDelegateCommand?
– 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
add a comment |
2 Answers
2
active
oldest
votes
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
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 thesetpart all together would be the best solution in that way there won't be a violation there
– G.hakim
Mar 11 at 10:13
add a comment |
I implement command wrong in XAML due to that I was facing this issue.
Thank you.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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 thesetpart all together would be the best solution in that way there won't be a violation there
– G.hakim
Mar 11 at 10:13
add a comment |
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
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 thesetpart all together would be the best solution in that way there won't be a violation there
– G.hakim
Mar 11 at 10:13
add a comment |
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
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
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 thesetpart all together would be the best solution in that way there won't be a violation there
– G.hakim
Mar 11 at 10:13
add a comment |
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 thesetpart 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
add a comment |
I implement command wrong in XAML due to that I was facing this issue.
Thank you.
add a comment |
I implement command wrong in XAML due to that I was facing this issue.
Thank you.
add a comment |
I implement command wrong in XAML due to that I was facing this issue.
Thank you.
I implement command wrong in XAML due to that I was facing this issue.
Thank you.
answered Mar 12 at 11:30
CGPA6.4CGPA6.4
2,91031132
2,91031132
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Use Prism.Forms it is best framework for MVVM
– K K
Mar 8 at 14:23
Can you point us to the
Commandimplementation? Side note: why do you want to not useDelegateCommand?– Haukinger
Mar 8 at 15:45
@Haukinger - Thank you for your input. I had wrong command implementation.
– CGPA6.4
Mar 11 at 5:30