none
Custom event args causing internal error? RRS feed

  • General discussion

  • hello,

    i've found some interesting behavior within the firing of custom events. im building a wpf control which sits inside a winform container. my wpf control has a couple custom events with custom event args + handler. now the interesting part is that in my winform, when i add my wpf control as "Private WithEvents xxx as XXX" then get the ide to generate a method signature for my custom event, i get a signature with a 'byval e as myNamespace.customEventArgs' param which is correct, however when my control fires this event at runtime i seem to get the following exception message: "object of type system.windows.routedeventargs cannot be converted to type myNamespace.customEventArgs".

    now the really interesting part is that when i comment out the "Handles myControl.CustomEvent" from the method signature and add "AddHandler myControl.CustomEvent, AddressOf autoGeneratedMethodSignature", everything seems to work without a problem.

    im guessing internally this must be some sort of bug which may have something to do with the elementhost propagating my wpf controls event, but i thought i'd just put it out there for whatever its worth :)

    Friday, August 19, 2011 9:33 AM