Error creating command

Aug 22, 2007 at 11:04 AM
I am trying to wire a command to the wpf control wich is an UI extension in a pure wpf shell, say a listviewitem for example. I mark some modulecontroller method
with command attribute like in the following exam:

CommandHandler(Constants.CommandNames.ActivateVisitorTable)
public void OnNavSelected(object sender, RoutedEventArgs ea)
{
ActivateWorkItem();
}

and in Run method I suppose to wire this command to extended invoker:

WorkItem.CommandsConstants.CommandNames.ActivateVisitorTable.AddInvoker(lvi, "Click"); --> where lvi is a listviewitem,

but I faile to do it as my project falls down in creation stage of a module controller with the exception from Delegate.CreateDelegate()
wich is saying that it can't bind to a method!

What am I doing wrong?
Aug 22, 2007 at 11:12 AM
I am sorry I made a mistake in post.
I am trying to wire commandhandler to the Selected event of ListViewItem of course.
Coordinator
Aug 24, 2007 at 2:28 AM
Hi Robert,

If I understand your question properly, I think it may be because your command handler has incorrect parameters. CAB looks for a method with signature (object sender, EventArgs e). If it doesn't match exactly, the command cannot be wired up. One option is to change the signature and do a cast in the handler. Let me know if this helps.

Regards,
Kent
Aug 24, 2007 at 10:23 AM
Hi Kent,

it works! Thank you! I tried to wire command to a specific event handler.

Do you have any plans to merge CAB's command framework with pure WPF command system in contrib project?

Best regards and thanks,
Robert T.
Coordinator
Aug 26, 2007 at 3:10 AM

Do you have any plans to merge CAB's command framework with pure WPF command system in contrib project?


Coincidentally, I am looking at doing exactly this right now. The biggest issue is that WPF's command infrastructure supports passing a command parameter whereas CAB's does not. I am hoping to have something checked in within a week or so, so keep an eye out.

Regards,
Kent