Reputation: 276235
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?
Upvotes: 4
Views: 238
Reputation: 942197
The ICommand.Execute() interface method is implemented explicitly. Docs are here.
Upvotes: 1
Reputation: 269588
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)
{
// ...
}
}
Upvotes: 10