Error when Raising an event:

Sep 11, 2009 at 11:43 PM
Edited Sep 12, 2009 at 2:59 AM

Hi,

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 9: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 2:49 AM

Same here.

Jul 29, 2010 at 9:25 AM
Taken from http://msdn.microsoft.com/en-us/library/system.weakreference.aspx 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!