private void Mouse_Moved(object pSender, MouseEventArgs pE) { // Get mouse position in screen coords Point mousePosition = pE.GetPosition(pSender as IInputElement); // Convert mouse screen coords to world coords mousePosition = ActualMap.ToWorldCoordinate(mousePosition); // Get the feature layer InMemoryFeatureLayer featureLayer = (InMemoryFeatureLayer) ActualMap.FindFeatureLayer("SomeLayerName"); // Get a list of all the features within the layer featureLayer.Open(); Collection features = featureLayer.QueryTools.GetAllFeatures(ReturningColumnsType.NoColumns); featureLayer.Close(); // Loop through every feature and see if the mouse is within foreach (Feature feature in features) { BaseShape currentShape = feature.GetShape(); // See if the mouse lies within the shape if (currentShape.Contains(mousePosition) { Console.WriteLine("yay"); // Of course, a breakpoint here :)
} } // foreach } // event // Debug : Mouse 6032915,3281 1577624,0693 Shape 0 6123046,9403 1482548,3798 Shape 1 6033625,8535 1581123,6545 Shape 2 6033123,2443 1577457,7021