Here is the definition of a member of ICommand : http://msdn.microsoft.com/en-us/library/system.windows.input.icommand.execute.aspx
The signature is:
void Execute(
Object parameter
)
It is implemented by RoutedCommand with the following signature ( http://msdn.microsoft.com/en-us/library/system.windows.input.routedcommand.execute.aspx ) :
public void Execute(
Object parameter,
IInputElement target
)
How can RoutedCommand Implement ICommand with an extra argument (IInputElement) in a member function?
It uses explicit interface implementation to "hide" the ICommand.Execute
method that takes a single parameter. The Execute
method that takes two parameters is not an implementation of ICommand.Execute
.
public class RoutedCommand : ICommand
{
public void Execute(object parameter, IInputElement target)
{
// ...
}
// explicit interface implementation of ICommand.Execute
void ICommand.Execute(object parameter)
{
// ...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With