Hi,
I want to show differents context menus for each component type (e.g. Y-Axis, LegendBox...).
Therefore I need to know which component was clicked.
For this I looked at the example "ExampleAnnotationsXY.cs".
In the MouseUp event the sender corresponds the clicked item.
But in my sample project the sender is always the LightningChart.
Do I have to set a special property or something else, so that the sender is my clicked component?
Thank you very much
Igor
MouseUp sender is not the clicked component
Moderator: Queue Moderators
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: MouseUp sender is not the clicked component
Every mouse-interactive object of LightningChart, like LightningChart itself, series, annotation, titles, legend boxes, axes etc. have their own set of mouse events. Chart's events can't be used for handling these sub-objects. Chart's events fire if no other mouse-interactive object was clicked, practically just the chart background. It fires also if sub-object's MouseInteraction = false, meaning that mouse hit test is not made for the sub-object at all.
To respond for example to annotation's MouseDoubleClick event, subscribe to annotation's MouseDoubleClick:
I hope this helps.
To respond for example to annotation's MouseDoubleClick event, subscribe to annotation's MouseDoubleClick:
Code: Select all
_chart.ViewXY.Annotations[0].MouseDoubleClick += new MouseEventHandler(annotation_MouseDoubleClick);
void annotation_MouseDoubleClick(object sender, MouseEventArgs e)
{
//sender is AnnotationXY
}
or X axis:
_chart.ViewXY.XAxes[0].MouseOverOn += new MouseEventHandler(xAxis_MouseOverOn);
void xAxis_MouseOverOn(object sender, MouseEventArgs e)
{
if (sender is Arction.LightningChartUltimate.Axes.AxisX)
{
MessageBox.Show(((Arction.LightningChartUltimate.Axes.AxisX)sender).Maximum.ToString("0.00"));
}
}
LightningChart Support Team, PT