public MainWindow()
{
CommandManager.AddExecutedHandler(this, ExecuteHandler);
}
void ExecuteHandler(object sender, ExecutedRoutedEventArgs e)
{
}
Error 1 Argument 2: cannot convert from 'method group' to 'System.Delegate'
public MainWindow()
{
CommandManager.AddExecutedHandler(this, ExecuteHandler);
}
void ExecuteHandler(object sender, ExecutedRoutedEventArgs e)
{
}
Error 1 Argument 2: cannot convert from 'method group' to 'System.Delegate'
You cannot pass a "method" directly as a parameter, you need to pass an expression. You can either wrap the method into a delegate:
or into a lambda – which is my personal favorite, since you don't need to memorize a delegate name:
I guess there are multiple ExecuteHandler with different signatures. Just cast your handler to the version you want to have: