in

Dé specialist in .NET trainingen en consultancy

Jo-wen Mei

Invoking an ICommand

 

I wanted to reuse the logic of a Command defined in another usercontrol.

The simple solution would be to create a separate, public method which I then could call from outside the control (and call this method in the Execute eventhandler).

A more clean way is to directly invoke the Command!

The ICommand interface supports the Execute(object parameter) method.

I expose my commands as static properties, so I can have this code:

SearchCommands.FilterProduct.Execute(null, SearchControl);

 

I don’t have to reference the commandBinding collection of the search control, which is very clean!

You can/must specify the input-element with the implementation you want to invoke.....

 

more info

Published dec 30 2009, 07:40 by Jo-wen
Filed under:

Comments

No Comments