Help: Mouse Event in Annotation

Oystein Bjorke vor 5 Jahren 0
This discussion was imported from CodePlex

Artiga wrote at 2013-10-15 15:31:

Hello guys!

In my plot I have a PolygonAnnotation, and I also have a line crossing this Polygon, I wanna trigger a action only if I click in the Polygon, not if I click in the line crossing the polygon ...

Doing like that:
var pa = new PolygonAnnotation
                {
                    Layer = AnnotationLayer.BelowAxes,
                    Points = annotationPolygon,
                    Color = OxyColors.Black,
                    Fill = OxyColors.Transparent,

                };  

pa.MouseDown += (s, e) =>
            {
                if (e.ChangedButton != OxyMouseButton.Left)
                {
                    return;
                }

               myAction();
               
                PlotModel.InvalidatePlot(false);
            };
In this way, when I click inside the polygon the action triggers, but if I click in a line crossing the polygon the action also triggers (probably because the line are inside the polygon), but I do not want that, its possible to solve this?

Artiga wrote at 2013-10-15 16:03:

Ok, I made a workaround using the shift button ... thx

everytimer wrote at 2013-10-15 22:10:

Did you try setting e.Handled = true?
CodePlex