Questions tagged [delegatecommand]

WPF design pattern that provides a generic reusable implementation of ICommand. Versions of this object can be found in the versions of Microsoft Prism.

95 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
  • 774
  • 2
  • 7
  • 17
14
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
  • 305
  • 5
  • 13
12
votes
5 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
  • 176,854
  • 291
  • 683
  • 1,015
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,189
  • 10
  • 46
  • 67
11
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
  • 90,453
  • 117
  • 313
  • 521
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,043
  • 2
  • 10
  • 19
9
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
  • 729
  • 3
  • 9
  • 20
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
  • 611
  • 5
  • 21
6
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,469
  • 1
  • 17
  • 25
6
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…
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
  • 8,221
  • 7
  • 43
  • 68
6
votes
3 answers

WPF CommandParameter binding and canExecute

I have a template for treeView item:
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.
  • 555
  • 7
  • 26
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,121
  • 1
  • 23
  • 38
4
votes
3 answers

jQuery: live() and delegate()

I'm binding a click event to a div element, which is created after clicking on a button. I'm using .live() and this is working. I've heard, that I should not use .live, but .delegate(). So I've tried it, but it is not working, but .live is…
Keith L.
  • 1,974
  • 11
  • 38
  • 64
1
2 3 4 5 6 7