windward-studios / ikvm8

Other
173 stars 36 forks source link

IKVM EventHandler cannot be converted to RoutedEventHandler #13

Closed jz499 closed 4 years ago

jz499 commented 4 years ago

Hi Everyone;

I'm trying to execute a function when a button is clicked, However I'm getting Javac errors. Does any know the correct code to use for a button click event?

Description:

Using IKVM to call .net UI components (buttons, textboxes,etc..) from java.

Code:

button.add_Click(new cli.System.EventHandler( new cli.System.EventHandler.Method () { public void Invoke (Object sender, cli.System.EventArgs e) { this.bu_click(sender, e); } }));

void bu_click(Object sender, cli.System.EventArgs e) { System.out.println("success"); }

void bu_click(Object sender, cli.System.EventArgs e) { System.out.println("success"); }

Error message:

App1.java:130: error: method add_Click in class ButtonBase cannot be applied to given types; button.add_Click(new cli.System.EventHandler( ^ required: RoutedEventHandler found: EventHandler reason: argument mismatch; EventHandler cannot be converted to RoutedEventHandler