Commands/Events with no parameter/payload

Jul 1, 2008 at 6:56 PM

I have a number of commands/events in my system that don't need a parameter/payload.  I was wondering if there was any guidance as far as how to best use DelegateCommand<TParameter> and CompositeWpfEvent<TPayload> in these situations?

Should I use DelegateCommand<object> and CompositeWpfEvent<object> and just ignore the parameter/payload?  Or would there be value in making UnparameterizedDelegateCommand and CompositeWpfEventWithoutPayload classes that take in delegates that have no parameters?


Jul 1, 2008 at 11:24 PM
Edited Jul 1, 2008 at 11:24 PM
Hi Lotrij

We don't have a DelegateCommand that does not accept parameters. If there are no paramters, you can simply use object as the parameter. Commands in WPF do require a parameter as part of the ICommand interface. As far as making an UnparameterizedDelegateCommand which accepts delegates of type Action (parameterless) this makes sense though we won't get to it as we ship tomorrow :) It would probably be useful to put this into the PrismContrib project.
Jan 24, 2009 at 5:54 PM

Hi lotrij

I provide a simple DelegateCommand implementation without the generic paramter in my libraries. You might find it useful.

Additionally, I have opened an Issue that proposes to add a simplified DelegateCommand into the CAL libraries: