Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am fairly new to WPF and working on Chart Custom control,
I wanted to allow user to click easily on any curve in the Chart to append desired information.
But the problem is, Clicking on the curve is very difficult.
Is there any way by which we can increase the selection area of the Curve on the chart?

Thanks in advance...
Posted

1 solution

I understand the problem. First thing which comes to my mind is padding your target curve with the transparent curve or other Shape which identical curve or shape, except transparency and thickness. This pad shape should be made much thicker by using the property Shape.StrokeThickness, http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape.strokethickness.aspx[^].

If you do so, you can handle the hit test on the padded curve and do the same action as the hit was done on your target curve.

This is just a suggestion. I did not face with this problem yet, just thought about it. So, I'm not sure if this is the best or the only technique.

—SA
 
Share this answer
 
Comments
Pankaj Babre 8-Feb-12 1:07am    
Hi SAKryukov,

Thank you for your suggestion.
Actually I was trying the possibility to add a Context Menu to the curve.
While doing so, when I wanted to raise it, chart was rarely invoking the curve context menu; as chart also has its context menu in my application.
But I had solved this problem by writing a small algorithm to increase the HitArea of the curve.
Now it's working properly.
Anyways, thanks for your time again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900