Alex Rivera | Logout

How do I fix 'compiler error - cannot convert from method group to System.Delegate'?

Asked 2010-03-19T18:56:15.747
22
 public MainWindow()
 {
    CommandManager.AddExecutedHandler(this, ExecuteHandler);
 }

 void ExecuteHandler(object sender, ExecutedRoutedEventArgs e)
 {
 }

Error 1 Argument 2: cannot convert from 'method group' to 'System.Delegate'

Edit
Report

1 Answer

20

I guess there are multiple ExecuteHandler with different signatures. Just cast your handler to the version you want to have:

CommandManager.AddExecuteHandler(this, (Action<object,ExecutedRoutedEventArgs>)ExecuteHandler);
answered 2010-03-19T18:58:51.377

Your Answer