Select to view content in your preferred language

MouseLeftButtonDown Event at Runtime

842
4
04-14-2011 11:02 AM
AgatinoLa_Rosa
Emerging Contributor
I have a GraphicsLayer managed at runtime, it is not coded in xaml. I have tried to add a click event
in the InitializeComponent() section of the cs for this layer:
myGraphicsLayer.MouseLeftButtonDown +=new GraphicsLayer.MouseButtonEventHandler(myGraphicsLayer_MouseLeftButtonDown);

and I get of delegate error. Any suggestion?
0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor

and I get of delegate error. Any suggestion?

Difficult to guess anything without seeing the handler.
0 Kudos
AgatinoLa_Rosa
Emerging Contributor
I am not sure if I follow you. Do you mean for handler:

private void myGraphicsLayer_MouseLeftButtonDown(object sender, MouseButtonEventHandler args)
        {
            ///zoom to selected graphic
        }
0 Kudos
DominiqueBroux
Esri Frequent Contributor
The second argument of your handler should be of type GraphicMouseButtonEventArgs

 
private void myGraphicsLayer_MouseLeftButtonDown(object sender, GraphicMouseButtonEventArgs args)
        {
            ///zoom to selected graphic
        }

This has been changed a few time ago, hence the confusion.
0 Kudos
AgatinoLa_Rosa
Emerging Contributor
Ouch!! Thanks. It works.
0 Kudos