Silverlight Mouse clicking bug

Sep 27, 2012 at 3:14 PM

Dear Objo (or others who know the solution)

In my project I use three mousehandlers on the plotmodel that is linked to the plot. Somehow if I click very fast, or move my mouse during the clicking (then it happens quicker) silverlight crashes. I think it has to do with putting annotation lines in the plotmodel, and a minimal example that has this behaviour can be seen at:

In the final project there is more data and more happens in the mousehandlers apart from the adding of the annotations. But this is a minimal example that also shows the crash.

When I do not use my own mousehandlers, there is also a but of lag sometimes when clicking excessively or moving the mouse around during the clicking. Could it have something to do with internal timelag and not being able to call the handlers quick enough?

Sep 29, 2012 at 6:40 PM
Edited Sep 29, 2012 at 6:41 PM

thanks for creating the minimal example. I am not sure why your example crashes, but I see you are adding the same annotation instances to the model's Annotations collection multiple times! OxyPlot currently does not check this for you. I did some changes and the following version does not crash on my machine

Sep 30, 2012 at 10:03 AM

Thank you for taking a look. This is very similar to what I do in my real project, I also check the axis for its inverse point to get the value to plot on. There I also clear the list of annotations before adding new ones I want to go render, because I also include a text and arrow annotation for the value. For this example I just set a fixed value, to make the code more readable, while it still crashed. 

I think that maybe the forwarding of the event and the GetAxesFromPoint(e.Positionout xaxis, out yaxis); method help the application from not crashing, but i'm not sure. But because I won't be working on this project anymore, I am not in a position to check if this will work or not. I have tipped a colleague who will take this over from me about this thread and hope / guess that he will take a look at it.