WPF design pattern that provides a generic reusable implementation of ICommand. Versions of this object can be found in the versions of Microsoft Prism.
Questions tagged [delegatecommand]
100 questions
19
votes
6 answers
Simplifying RelayCommand/DelegateCommand in WPF MVVM ViewModels
If you're doing MVVM and using commands, you'll often see ICommand properties on the ViewModel that are backed by private RelayCommand or DelegateCommand fields, like this example from the original MVVM article on MSDN:
RelayCommand…

Ben Schoepke
- 789
- 2
- 7
- 17
16
votes
3 answers
How to Unit Test DelegateCommand that calls async methods in MVVM
I am new to Unit Testing MVVM and using PRISM on my project. I am implementing Unit Testing on our current project and not having luck finding resources online that would tell me how totest DelegateCommand that calls async method. This is a follow…

Jepoy_D_Learner
- 435
- 1
- 6
- 13
13
votes
6 answers
How do I pass the information from View to ViewModel with DelegateCommand?
In my View, I have a button.
When the user clicks this button, I want to have the ViewModel save the context of the TextBlock in the database.

Edward Tanguay
- 189,012
- 314
- 712
- 1,047
12
votes
4 answers
In which namespace is the DelegateCommand in?
I am trying to work out an example from ".NET Domain Driven Design with C#", which contains a code example where you can see declared some attributes of type DelegateCommand.
Now, I've tried googling it up, but I can't find its reference anywhere on…

devoured elysium
- 101,373
- 131
- 340
- 557
11
votes
4 answers
How to fire a Command when a window is loaded in wpf
Is it possible to fire a command to notify the window is loaded.
Also, I'm not using any MVVM frameworks (Frameworks in the sense, Caliburn, Onxy, MVVM Toolkit etc.,)

Prince Ashitaka
- 8,623
- 12
- 48
- 71
11
votes
3 answers
Memory leak in WPF app due to DelegateCommand
I just finished desktop apps written in WPF and c# using MVVM pattern. In this app I used Delegate Command implementation to wrap the ICommands properties exposed in my ModelView. The problem is these DelegateCommands prevent my ModelView and View…

Abdullah BaMusa
- 1,069
- 3
- 10
- 19
10
votes
1 answer
WPF & MVVM: Get values from textboxes and send it to ViewModel
I'm trying to get the value of two Texboxes (I'm simulating a login window) when I press a button. The command assigned in the button fires correctly, but I don't know how to get the value of the textboxes to do the "login".
This is my…

Oscar Mateu
- 789
- 3
- 10
- 22
8
votes
2 answers
Why use a RelayCommand or DelegateCommand instead of just implementing ICommand?
I'm just learning about MVVM in WPF, I'm completely new both to WPF as to MVVM (I understand how it works, but have never used it...)
Every single tutorial/article I find on the web, it uses either RelayCommand, or the DelegateCommand.
In my opnion,…

David Anderson
- 623
- 5
- 22
7
votes
5 answers
is there a uipickerview delegate method like scrollviewDidScroll?
I have a customized UIPickerview and I do not want to use a datepicker. I want to implement the feature where when a user scrolls down/up the hours, the AM/PM component switches while the hour is scrolling. This means that I need to switch it…

Andrew Park
- 1,489
- 1
- 17
- 26
7
votes
3 answers
Why are RelayCommand or DelegateCommand not part of WPF?
The Model-View-ViewModel (MVVM) approach seem to be the front-runner pattern in WPF UI development. Almost every article I read implies that it is the best-practice. Usage of RelayCommand or DelegateCommand is also prominent in many articles and it…

Patricia Coelho
- 71
- 2
6
votes
4 answers
When does the ui detach from commands?
I'm really scratching my head with this one. I have a mainwindow which opens a dialog. After the dialog closes, the CanExecute method on commands bound in the dialog are still executing. This is causing some serious problems in my…

Marius
- 9,208
- 8
- 50
- 73
6
votes
3 answers
WPF CommandParameter binding and canExecute
I have a template for treeView item:
5
votes
3 answers
DelegateCommand throws "Specified cast is not valid"
I want to use a PRISM delegatecommand with a bool as parameter. This is the relevant code:
public class ChartViewModel : BindableBase
{
public DelegateCommand ChangeZoomPanCommand { get; private set; }
private bool isInRealtimeMode;
…

Jef Patat
- 999
- 1
- 10
- 26
5
votes
1 answer
WPF PRISM 6 DelegateComand ObservesCanExecute
Thanks in advance!
How should I use ObservesCanExecute in the DelegateCommand of PRISM 6?
public partial class UserAccountsViewModel: INotifyPropertyChanged
{
public DelegateCommand InsertCommand { get; private set; }
public DelegateCommand…

Andrey K.
- 665
- 8
- 29
4
votes
2 answers
How to call RaiseCanExecuteChanged for all DelegateCommand and DelegateCommand in base ViewModel Class
I am developing a WPF application using Prism and MVVM.
One of the requirements of the application is ability to login as different user (with different permissions).
Now most of the permissions are simple allow or disallow display particular…

Michael D.
- 1,249
- 2
- 25
- 44