In which namespace is the DelegateCommand in?
Asked Answered
C

4

13

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 MSDN (actually, I found this article, but not DelegateCommand's article itself).

Is the DelegateCommand something that's part of WPF or is it just something created in the book?

If it's part of WPF (or any other MS product), in which assembly/namespace is it?

Cincture answered 20/7, 2010 at 7:5 Comment(0)
P
3

The DelegateCommand is not (yet) part of the standard library (BCL).

It is part of WPF command-binding for MVVM.

Until we get an 'official' MVVM template in VS, all the MVVM examples/toolkits define it somewhere themselves. Not always with the same name or in the same place.

Pepito answered 20/7, 2010 at 7:32 Comment(0)
C
10

If you use MS Prism,downlaod the lib, add the reference to the project, then you have

using Microsoft.Practices.Prism.Commands; // for DelegateCommand & RaisePropertyChanged
Caenogenesis answered 20/6, 2012 at 11:41 Comment(1)
If you want to get Prism, make sure NuGet is installed, open the package Manager Console and enter Install-Package prism.Mccomas
H
3

DelegateCommands is a custom implementation of ICommand. DelegateCommand was introduced(correct me if I am wrong) in prism(Composite Application framework) - http://compositewpf.codeplex.com/

You can use that or you can implement your own as done here -

https://web.archive.org/web/20101120214610/http://kentb.blogspot.com/2009/04/mvvm-infrastructure-delegatecommand.html

Hindenburg answered 20/7, 2010 at 7:32 Comment(0)
P
3

The DelegateCommand is not (yet) part of the standard library (BCL).

It is part of WPF command-binding for MVVM.

Until we get an 'official' MVVM template in VS, all the MVVM examples/toolkits define it somewhere themselves. Not always with the same name or in the same place.

Pepito answered 20/7, 2010 at 7:32 Comment(0)
L
2

I've found it called RelayCommand (I think that's the original name, to be honest). Please see here:

MVVM Routed and Relay Command

http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090051

Hope that helps!

Lissner answered 20/7, 2010 at 7:34 Comment(1)
From the MSDN article - "RelayCommand is a simplified variation of the DelegateCommand found in the Microsoft Composite Application Library."Hindenburg

© 2022 - 2024 — McMap. All rights reserved.