Select to view content in your preferred language

Identify tool

657
1
09-16-2011 08:49 AM
JerryBiedenbender
Emerging Contributor
Hello,


    I would like to add an identify tool to my map but the one in the code gallery takes up too much space, Does anyone have one that could fit in the toolkit so it can be activated when needed instead of always being on?

Thanks,
Jerry
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
Have you looked at this SDK sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify

You can tweak it so you only subscribe to MouseClick event when button is clicked or use boolean to indicate when it is active. I mashed the two solutions here but you do either one.
bool identifyIsActive = false;
private void Button_Click(object sender, RoutedEventArgs e)
{
           MyMap.MouseClick +=QueryPoint_MouseClick; //to subscribe programmatically
           identifyIsActive = !identifyIsActive; //to update boolean 
}
private void QueryPoint_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
           (sender as Map).MouseClick -= QueryPoint_MouseClick; //to unsubscribe 
           if(!identifyIsActive) return; //when using boolean
           //Identify code goes here.
}
0 Kudos