Error when Raising an event:

Sep 12, 2009 at 12:43 AM
Edited Sep 12, 2009 at 3:59 AM


Your dll is really great stuff. It will be a life saver for me. Thanks a lot.  I followed the sample but when try to raise the event inside the user control  it pops the  following error

"Object reference not set to an instance of an object." 

  private void OnClick(object sender, System.Windows.RoutedEventArgs e)
this.RaiseEventEx(new RoutedEventArgsEx(HoverEnterEvent));

I read the first post in the "discussions" and he said he had to change the WeakReference to strong. I think I've the same situation here but no idea how to change it to strong. Is there any chance to show an example?

Thanks in advance


Dec 11, 2009 at 10:58 PM

Great work! But i too get the same error 'Object reference not set to an instance of an object.', while raising the event. Any suggestions will be of great help.

Dec 23, 2009 at 3:49 AM

Same here.

Jul 29, 2010 at 10:25 AM
Taken from WeakReference Class -> Represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection. So the solution to get this library to work is: go to the file RoutedEventHandlerData.cs and replace the WeakReferences. e.g.: private WeakReference _uihandler -> private UIElement _uiElement; do this for all occurences of WeakReference. you will also have to fix the properties e.g. UIHandler. After this, the library works like a charme. have a nice day!